Fix in tree traversal algorithm.