Some fixes to make it work again on Mac OS X