bugfix: avg is incorrect