added a special case when calculating the average value of a single object