Handle 404 errors and add debug call