fixed the tree sorter