modify error handler to include more options