fix average plugin bugs

if total value to get averate value is zero, it returns 0