Fixed possible scope bug