Fixed comparison when sorting lists.