modified handling of http errors