fixed looping issue
Merge pull request #36 from mbeale/master

Fix a looping issue