Fix bug causing erroneous sending of cancellation messages.