Fixed some regressions caused by modifying aggregate in tests