fix inverted sort