Fixed wrong ordinals after sorting