Patched version for OSX and ruby 1.9