Improve error handling for 404s, close #825.