global scope bug fixed