fix global var declaration error