Fix sort order for trees.