make encoding task cancellable