Fix build on OSX and Windows