corrected comparator