Fixed sorting regressions