Fixed the scriptblockuse of vars outside the scope of the scriptblock