Fixing problems with error handler