fixed sorting error