Fixed varibles to avoid depracated scope lookup before it's a problem.