small fix to average