Added some fixes for OS X