fixing the bug in the loop - extra do statement