Added max loop in parameter in case not converge