fixed the bug in which the direction of comparator is opposite my mistake.