fixed an issue with http error handling