Fix aggregateBy tuning

closes #418