now the avg is also calculated correctly