fix cancel's check for running tasks