fixed scope bug