Fix assertion of lists, using sorted.