fixed error handling for http request failures