This looks wrong to me as the next ``if`` can change the transport