updated for version 7.0181
diff --git a/src/eval.c b/src/eval.c
index 4823593..c18b42d 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -17667,7 +17667,18 @@
     }
 
     if (lv.ll_exp_name != NULL)
+    {
 	len = STRLEN(lv.ll_exp_name);
+	if (lead <= 2 && lv.ll_name == lv.ll_exp_name
+					 && STRNCMP(lv.ll_name, "s:", 2) == 0)
+	{
+	    /* When there was "s:" already or the name expanded to get a
+	     * leading "s:" then remove it. */
+	    lv.ll_name += 2;
+	    len -= 2;
+	    lead = 2;
+	}
+    }
     else
     {
 	if (lead == 2)	/* skip over "s:" */
diff --git a/src/memfile.c b/src/memfile.c
index e1a6b60..bac84fe 100644
--- a/src/memfile.c
+++ b/src/memfile.c
@@ -701,6 +701,23 @@
 }
 
 /*
+ * For all blocks in memory file *mfp that have a positive block number set
+ * the dirty flag.  These are blocks that need to be written to a newly
+ * created swapfile.
+ */
+    void
+mf_set_dirty(mfp)
+    memfile_T	*mfp;
+{
+    bhdr_T	*hp;
+
+    for (hp = mfp->mf_used_last; hp != NULL; hp = hp->bh_prev)
+	if (hp->bh_bnum > 0)
+	    hp->bh_flags |= BH_DIRTY;
+    mfp->mf_dirty = TRUE;
+}
+
+/*
  * insert block *hp in front of hashlist of memfile *mfp
  */
     static void
diff --git a/src/memline.c b/src/memline.c
index 9abf155..c87a955 100644
--- a/src/memline.c
+++ b/src/memline.c
@@ -563,7 +563,13 @@
 
 	    /* Flush block zero, so others can read it */
 	    if (mf_sync(mfp, MFS_ZERO) == OK)
+	    {
+		/* Mark all blocks that should be in the swapfile as dirty.
+		 * Needed for when the 'swapfile' option was reset, so that
+		 * the swap file was deleted, and then on again. */
+		mf_set_dirty(mfp);
 		break;
+	    }
 	    /* Writing block 0 failed: close the file and try another dir */
 	    mf_close_file(buf, FALSE);
 	}