fix var scope