Fix mutual information code.

Fixed part of the code that could give NaN or negative values for
mutual information due to determinism (in the first case) and rounding
dust (in the second case).