make string loop detection working