fixed sorting order errors