Add some fixes for OSX.