bugfix: introduce local variables before assigning it for self-recursive functions