fix global scope check