Slight fix to allow the task to be cancellable