Fixes for Mac OSX