note the case of wrong detection of circular reference

 - todo: fix it by pop_back
fix wrong detection of circular reference