Fix regression causing profile names to be listed in random order. #1864