fix entropy calculation