Fixes to get it building on Mac OS X