improved handling of HTTP connection errors