fixed errors in calculating entropy