fix memory leak
add TreeNode