fix bug in comparator.