fixed bug for recursive passed by ref.