replaced error handler on mac