Some fixes for OS X