Added more control of HTTP errors