fixing alert box for iteration