Fixes to OSX support