fix cyclic dependency bug