fixed wrong local variable use