fixed comparator to take array and single