add cycledetection