add tree_clear function