Entropy calculation fix