removing flush_and_error from on_error handler