fix bug for tree traverse