[agg] Fix insert logic