Fix sort position detection.