Added convergence check to EM