avoid cyclic paths