backport PR #522 sortByName() to 0.9.X