Fix code bug for removing cyclic dependency and fix unit test. Test: hmake test Change-Id: Ib4d4ba416d0133542e6459459ddf43079ff53ab8