corrected a bug in entropy calculation