core: fix in scope of some js vars.