diff --git a/src/runtime.c b/src/runtime.c
index 6bb8d86e2750cfce8605edcbf806e187ee2bae9d..180358dfaac28c5d46f0e007a973105d540875db 100644
--- a/src/runtime.c
+++ b/src/runtime.c
@@ -297,7 +297,9 @@ pv_runtime_finalize (GObject *object)
   g_free (self->runtime_usr);
   g_free (self->source_files);
   g_free (self->tools_dir);
-  pv_bwrap_lock_free (self->runtime_lock);
+
+  if (self->runtime_lock != NULL)
+    pv_bwrap_lock_free (self->runtime_lock);
 
   G_OBJECT_CLASS (pv_runtime_parent_class)->finalize (object);
 }
diff --git a/src/wrap-interactive.c b/src/wrap-interactive.c
index 946f3a98e509bb35618fec427ebbccd3a57adc1d..0bf397f6a2503685ef6ccdd50f0075cbe408822d 100644
--- a/src/wrap-interactive.c
+++ b/src/wrap-interactive.c
@@ -54,7 +54,7 @@ pv_bwrap_wrap_interactive (FlatpakBwrap *wrapped_command,
       "echo\n"
       "echo\n"
       "echo\n"
-      "echo \"$1: Starting interactive shell (original command is in "
+      "echo \"$prgname: Starting interactive shell (original command is in "
       "\\\"\\$@\\\")\"\n"
       "echo\n"
       "echo\n"
@@ -72,6 +72,7 @@ pv_bwrap_wrap_interactive (FlatpakBwrap *wrapped_command,
           "e=0\n"
           "\"$@\" || e=$?\n"
           "echo\n"
+          "echo \"$prgname: command exit status $e\"\n"
           "echo \"Press Enter or ^D to continue...\"\n"
           "read reply || true\n"
           "exit \"$e\"\n";
@@ -80,13 +81,14 @@ pv_bwrap_wrap_interactive (FlatpakBwrap *wrapped_command,
       case PV_SHELL_AFTER:
         script =
           "e=0\n"
-          "\"$@\" || e=$?\n";
+          "\"$@\" || e=$?\n"
+          "echo \"$prgname: command exit status $e\"\n";
         break;
 
       case PV_SHELL_FAIL:
         script =
           "if \"$@\"; then exit 0; else e=\"$?\"; fi\n"
-          "echo \"$1: command exit status $e\"\n";
+          "echo \"$prgname: command exit status $e\"\n";
         break;
 
       case PV_SHELL_INSTEAD:
@@ -105,9 +107,9 @@ pv_bwrap_wrap_interactive (FlatpakBwrap *wrapped_command,
                           "sh", "-euc",
                           command,
                           "sh",   /* $0 for sh */
-                          g_get_prgname (),   /* $1 for sh */
+                          g_get_prgname (),   /* $1 = $prgname for sh */
                           /* Original command will go here and become
-                           * the argv of command, and eventually
+                           * the rest of the argv of command, and eventually
                            * the argv of bash -i -s */
                           NULL);
 }