Minor changes to make it work on OS X