Fix issue in error handler