some changes in AggObs function