Fix compile errors on OSX