Infinite loop bug

This caused an infinite loop when I had a string along the lines of something like " Next ". This is the simple fix.
Merge pull request #1252 from csaftoiu/patch-2

Infinite loop bug