  		}
  
  	/* Finished, tear down connection.				*/
- 
--	if ((*(prot.prot->teardown))(tx_asn) == -1)
-+	if (tx_asn >= 0 && (*(prot.prot->teardown))(tx_asn) == -1)
- 		{
- 
+@@ -1154,8 +1175,11 @@
  		/* log the teardown error. */
-@@ -1156,6 +1177,7 @@
+ 
  		perror("do_actions: protocol teardown");
++#ifndef USEEVENTS
  		exit(-1);
++#endif
  		}
 +	active_tx_asn = -1;
  
  	return;
  	}
-@@ -1341,6 +1363,12 @@
+@@ -1341,6 +1365,12 @@
  
  		if (arrival != 0)
  			(*(prot.prot->sleep_till))(&nextpkt_tv);

 	/* Encode record type.						*/
 
 	*cp++ = LOGTYPE_TEARDOWN;
@@ -567,6 +592,11 @@
 	char		buf[100];
 	char		*cp = buf;
 	char		ctl;
+
+#ifdef USEEVENTS
+	if (log_fp == NULL)
+		return;
+#endif
 
 	/* Encode record type.						*/
 
diff -ru dist-tg2.0/src/tg/prot_dgram.c tg2.0/src/tg/prot_dgram.c
--- dist-tg2.0/src/tg/prot_dgram.c	Thu Jan 24 16:30:10 2002

 			    (void)close(sfd);
diff -ru dist-tg2.0/src/tg/tg.y tg2.0/src/tg/tg.y
--- dist-tg2.0/src/tg/tg.y	Thu Jan 24 16:30:10 2002
+++ tg2.0/src/tg/tg.y	Fri May  3 13:27:53 2002
@@ -133,7 +133,11 @@
 char                    *version = "2.0";	/* TG program version.	*/
 char			*ofile = NULL;
