osx build and fixes