fix some MAC OSX compatibility issues