properly handle HTTP 5xx