Fix infinite looping bug
Merge pull request #1 from 0674272bac/fix_infinite_loop

Fix infinite looping bug