more improvements to http error handling