fixing scope bug