fix cancelling of tasks