Improved MacOSX compatibility