fixes for building on OS X