updated with PR2307 using ``sqrt_mod_iter``