Fixed compare bug in comparator