fix local/global var error