fixes to build on OSX