Fixed log entropy calculation