Register the error handler in a better place.