Some updates to make it work on Mac OS X