Fixes for building on OSX