Fixes to compile on OS X