OSX Clang fixes

Fixes for compiling with AppleClang on OSX.

Also confirmed that it still builds with Clang on Linux and gcc on Linux.