fixing the uncancelable bug in AlgorithmWorker