diff --git a/xtrn/tw2/input.js b/xtrn/tw2/input.js
index 0c38da55235d1b4ff28509f9c1d1cedf192d2489..217d2e2d544d422de0d2c529391082c6ad035d75 100644
--- a/xtrn/tw2/input.js
+++ b/xtrn/tw2/input.js
@@ -36,6 +36,12 @@ function CheckTime()
 	}
 }
 
+function CheckTerminate()
+{
+	if(js.terminated)
+		exit(0);
+}
+
 function InputFunc(values)
 {
 	var str='';
@@ -51,6 +57,7 @@ InputFuncMainLoop:
 	for(;;) {
 		CheckNode();
 		CheckTime();
+		CheckTerminate();
 
 		key=console.inkey(100);
 		if(key == '') {
diff --git a/xtrn/tw2/sectors.js b/xtrn/tw2/sectors.js
index 98819af26990b80a257745f04ffae3d76b59d297..7158089d32be018a09421603f40a6842a5079850 100644
--- a/xtrn/tw2/sectors.js
+++ b/xtrn/tw2/sectors.js
@@ -99,7 +99,7 @@ function EnterSector()	/* 20000 */
 				break;
 			case 'Q':
 				console.write("Are you sure (Y/N)? ");
-				if(console.getkeys("YN")=='Y') {
+				if(InputFunc(['Y','N'])=='Y') {
 					exit_tw2=true;
 					return(false);
 				}
diff --git a/xtrn/tw2/tw2.js b/xtrn/tw2/tw2.js
index 033f0d540ad95ad1048c602a4c3298093f4cde4e..f8bef4b0f05abc40d0d6e6c4e84d2448f6c10de6 100644
--- a/xtrn/tw2/tw2.js
+++ b/xtrn/tw2/tw2.js
@@ -49,6 +49,7 @@ twopeng.open("a", true);
 var today=system.datestr(system.datestr());
 
 js.on_exit("do_exit()");
+js.auto_terminate=false;
 /* Run maintenance */
 if(Settings.MaintLastRan != system.datestr()) {
 	RunMaint();
@@ -180,7 +181,7 @@ function Menu()
 				console.writeln("<Quit>");
 				console.attributes="W";
 				console.write("Are you sure (Y/N)? ");
-				if(console.getkeys("YN")=='Y') {
+				if(InputFunc(['Y','N'])=='Y') {
 					exit_tw2=true;
 					return;
 				}
@@ -224,11 +225,9 @@ function do_exit()
 function Instructions()
 {
 	console.write("Do you want instructions (Y/N) [N]? ");
-	switch(console.getkey().toUpperCase()) {
-		case 'Y':
-			console.crlf();
-			console.printfile(fname("twinstr.doc"));
-			break;
+	if(InputFunc(['Y','N'])=='Y') {
+		console.crlf();
+		console.printfile(fname("twinstr.doc"));
 	}
 }