add condition on iteration