fixes for compilation on Mac OS X