Fixes for building on OS X with clang