Repair broken while

If the loop is not executed the old code will not correctly skip the loop.
Merge pull request #1 from rdebath/patch-1

Repair broken while