tweaked validity code for cancellation