Handling of errors to 404s and 500s