Osx fixes

These are all the changes necessary to build on Yosemite (OSX 10.10)