add in an error handler