Fix using sort for correct list when switching lists.