fix global var usage