Fix the bug in calculate KL-divergence