more accurate cyclic dependency resolution