Better handling of quit/exit (bug #218)