BugFix: add main function scope as var to all "subfunctions"