fix possible crash for errored http responses