Fixed undefined local variable