Fixes to the error page code and error handler