diff --git a/exec/lbshell.js b/exec/lbshell.js
index 3c0233d847eb7a42126847aaf01cd1722d5fd447..62d32b690d05375b65a70463a2f090de6d4b5606 100644
--- a/exec/lbshell.js
+++ b/exec/lbshell.js
@@ -710,7 +710,7 @@ while(bbs.online) {
 						}
 						catch(e) {
     						console.writeln("DOORSCAN ERROR: "+e);
-    						log("Error running "+xtrn_area.sec_list[xsec].prog_list[i].code+" "+e);
+    						log("Error running "+xtrn_area.sec_list[curr_xtrnsec].prog_list[parseInt(x_prog)].code+" "+e);
 						}
 					}
 					else {