now it calculates average entropy correctly