fix memory leakage on cancelation