Fix agg type bug