Add dependency loop check