Improved 404 error handling