It seems to be an issue when there's a mix of one digit and two digit entries in the list.
The sorting is alphabetical, so in the top red rectangle, 2 is greater than 14. Same for bottom example, 3 is greater than 23 eventhough it should be the other way around.
Perhaps adding a trailing zero...