Fixed bugs for mle per group