fixed sorting issue