Corrected NameError for invalid variable