Some fixes to build on OSX.