fixed bug in TreeIterator