updated loop condition
Merge pull request #1 from vivanov1410/patch-1

updated loop condition