fixed sorting bug.