fixed averaverage and total logic