Mac OSX compatibility fix