Fix invalid gateway response handling.