fixing cycle checking in AGREE