OSX Compatibility

Compile fixes for OSX.