diff --git a/src/syncterm/term.c b/src/syncterm/term.c
index 45658aa5c529ab0b4c096821c4d4991f0bc60ce9..074f4353be6d31e84c154fa9810ffb2f051d0bac 100644
--- a/src/syncterm/term.c
+++ b/src/syncterm/term.c
@@ -1838,7 +1838,8 @@ void xmodem_download(struct bbslist *bbs, long mode, char *path)
 			break;
 		if((cps=(unsigned)(file_bytes/t))==0)
 			cps=1;
-		total_files--;
+		if (--total_files <= 0)
+			break;
 		total_bytes-=file_bytes;
 		if(total_files>1 && total_bytes)
 			lprintf(LOG_INFO,"Remaining - Time: %lu:%02lu  Files: %u  KBytes: %"PRId64