Fix for #3596 (http://projects.blender.org/tracker/index.php?func=detail&aid=3596&group_id=9&atid=125)