Fix 404 handling and add a test.