fixing stupid mistake with cycle detection.