fixed bug, cycles was not being calculated properly