fixed the problem of not being able to solve cycles