refactor code error page