improving error handling and page not found handling