Fixes for MacOSX