Add build fixes for mac osx