Fixing scope bug