Fixing scope problem