Correction for aggregate functions