Bug fixed in allPossibleSubstrings