diff --git a/src/p_setup.c b/src/p_setup.c
index 4f21922a0c57b77bd9870814c8160cf8c46171d0..f6abc70e6a9e467a5f2d8ea226a5cd92f56a7753 100644
--- a/src/p_setup.c
+++ b/src/p_setup.c
@@ -4373,7 +4373,7 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
 
 	// internal game map
 	maplumpname = G_BuildMapName(gamemap);
-	lastloadedmaplumpnum = W_CheckNumForName(maplumpname);
+	lastloadedmaplumpnum = W_CheckNumForMap(maplumpname);
 	if (lastloadedmaplumpnum == LUMPERROR)
 		I_Error("Map %s not found.\n", maplumpname);
 
diff --git a/src/w_wad.c b/src/w_wad.c
index e49e0ce82f9ffe24c06d757b61b2a69bbc10ee2a..b594912f1b881f7f48417afd9c34d9899ffcb28a 100644
--- a/src/w_wad.c
+++ b/src/w_wad.c
@@ -1463,8 +1463,14 @@ lumpnum_t W_CheckNumForMap(const char *name)
 				continue;
 			// Now look for the specified map.
 			for (; lumpNum < end; lumpNum++)
-				if (!strnicmp(name, (wadfiles[i]->lumpinfo + lumpNum)->name, 8))
-					return (i<<16) + lumpNum;
+			{
+				if (!strnicmp(name, wadfiles[i]->lumpinfo[lumpNum].name, 8))
+				{
+					const char *extension = strrchr(wadfiles[i]->lumpinfo[lumpNum].fullname, '.');
+					if (!(extension && stricmp(extension, ".wad")))
+						return (i<<16) + lumpNum;
+				}
+			}
 		}
 	}
 	return LUMPERROR;