Fix Tree/Sort compatibility