Fixed bug in cancelation logic