Fix HTTP error handling