How can the loop be stopped after one cycle?