Make name-based sorting work as expected