improved cancelation detection and handling