fix memory leak by using inner cts.