Improvements to default error and 404 handling