Better error checking on OSX