fix comparator bug