Fixes to compile under Mac OSX