diff --git a/src/message.c b/src/message.c
index 3b1b458922cb49cb83fd2f1d9101b8ddda767ad4..c33b173b89bba6088362ed31d5ece4b80dbcf11d 100644
--- a/src/message.c
+++ b/src/message.c
@@ -1135,8 +1135,11 @@ msg_start()
 {
     int		did_return = FALSE;
 
-    vim_free(keep_msg);
-    keep_msg = NULL;			/* don't display old message now */
+    if (!msg_silent)
+    {
+	vim_free(keep_msg);
+	keep_msg = NULL;		/* don't display old message now */
+    }
 
 #ifdef FEAT_EVAL
     if (need_clr_eos)
diff --git a/src/misc2.c b/src/misc2.c
index 3c25a1f08792de14f358559722c8f13ceda21858..8492b3e81548206db6256024a077cb833f4e4c92 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -4016,9 +4016,9 @@ get_crypt_key(store, twice)
     }
 
     /* since the user typed this, no need to wait for return */
-    need_wait_return = FALSE;
     if (msg_didout)
 	msg_putchar('\n');
+    need_wait_return = FALSE;
     msg_didout = FALSE;
 
     free_crypt_key(p2);