fix self-reference bug