Fix incorrect matching in 404 response generation