Correct implementation for MacOS X