change NameError to Exception