added custom error page handling