fixed looping issue
Merge pull request #1 from thesamtang/master

fixed looping issue