Fixes for OSX building