Fix bug in error handler.