Fix NameError
Fix local variable not defined