Fix infinite loop
Merge pull request #1 from Ryman/patch-1

Fix infinite loop