Fixed maximum recursion depth problem which occurs when trying to find long strings