Fix UnboundLocalError: local variable 'cur_definition_names' referenced before assignment