fix a "log(0)" bug in calculating log-likelihood