Merge "Change conditionallyCheckInstanceCounts to use countInstancesOfClasses"