Fixed the inability to sort lists with repetitions.