Fix task cancelling