Improve Page404 and Page500 handlers