fix error handler order