Fixes for MacOSX and clang