fix the min,max,avg,and sum function