fix comparator for sort