Fixes to build to make it OSX compatible