better handling of HTTPErrors