fixed a sorting error