add cyclic dependency detection