Fixed issues with calculation of log-likelihood.