Added error handling for 404 errors