Fixed bug with recognition of already found cycles