Changes to make it build on OSX