diff --git a/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/RCommand.java b/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/RCommand.java
index fc99b4772ba99fe30506607155c1493b56ceebc2..dc891a94003a5e84a79b27dc8077cea4b4fbacb4 100644
--- a/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/RCommand.java
+++ b/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/RCommand.java
@@ -104,9 +104,13 @@ public class RCommand {
     }
 
     public static void main(String[] args) {
-        System.exit(doMain(prependCommand(args), null, System.in, System.out, System.err));
-        // never returns
-        throw fatal("main should never return");
+        try {
+            System.exit(doMain(prependCommand(args), null, System.in, System.out, System.err));
+            // never returns
+            throw fatal("main should never return");
+        } catch (Throwable t) {
+            throw fatal(t, "error during REPL execution");
+        }
     }
 
     static String[] prependCommand(String[] args) {
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/AbstractLoopNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/AbstractLoopNode.java
index 72a6608175c99b69489c916760bc039dc2d87bfe..8b44c6d0176fe299f073733c4ef47d53eda03998 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/AbstractLoopNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/AbstractLoopNode.java
@@ -32,6 +32,7 @@ import com.oracle.truffle.r.runtime.nodes.RNode;
 import com.oracle.truffle.r.runtime.nodes.RSyntaxCall;
 import com.oracle.truffle.r.runtime.nodes.RSyntaxElement;
 import com.oracle.truffle.r.runtime.nodes.RSyntaxLookup;
+import com.oracle.truffle.r.runtime.nodes.RSyntaxNode;
 
 /** Marker class for loops. */
 public abstract class AbstractLoopNode extends OperatorNode {
@@ -47,9 +48,9 @@ public abstract class AbstractLoopNode extends OperatorNode {
         if (rootNode instanceof RRootNode) {
             function = rootNode.toString();
         }
-        SourceSection sourceSection = getSourceSection();
+        SourceSection sourceSection = getLazySourceSection();
         int startLine = -1;
-        if (sourceSection != null) {
+        if (sourceSection != null && sourceSection != RSyntaxNode.LAZY_DEPARSE && sourceSection != RSyntaxNode.INTERNAL && sourceSection != RSyntaxNode.SOURCE_UNAVAILABLE) {
             startLine = sourceSection.getStartLine();
         }
         RSyntaxElement call = ((RSyntaxCall) this).getSyntaxLHS();