fix build on OS X and BSD