changes related to #641 for os x

(cherry picked from commit 4973aa986ee001bf4daa9f6288904d6f78da50a0)