fixing bug that raises error when the error page is rendered