fix error in error handler