fixed aggregate script