Fixed null substitute issue in aggregate