fix wrong local variable usage