fix bugs: cyclic pointer