fix typo in average method