fixed loglikelihood computation