Fixes for working on Mac OSX