added OSX exception support