Adding patch for OSX support (thanks Tor Andre)