Added http error handling.