added patches for compiling on OSX