fix to find cycles