fixed local variable issue