diff --git a/src/m_misc.c b/src/m_misc.c
index 621d705f9084131b2af359655a60b5a8f13ac809..6fdae94115905ce3cdf4b62d8f5aa13c112268b9 100644
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -1057,7 +1057,7 @@ static boolean M_SetupaPNG(png_const_charp filename, png_bytep pal)
 static inline moviemode_t M_StartMovieAPNG(const char *pathname)
 {
 #ifdef USE_APNG
-	UINT8 *palette;
+	UINT8 *palette = NULL;
 	const char *freename = NULL;
 	boolean ret = false;
 
@@ -1073,8 +1073,13 @@ static inline moviemode_t M_StartMovieAPNG(const char *pathname)
 		return MM_OFF;
 	}
 
-	if (rendermode == render_soft) M_CreateScreenShotPalette();
-	ret = M_SetupaPNG(va(pandf,pathname,freename), (palette = screenshot_palette));
+	if (rendermode == render_soft)
+	{
+		M_CreateScreenShotPalette();
+		palette = screenshot_palette;
+	}
+
+	ret = M_SetupaPNG(va(pandf,pathname,freename), palette);
 
 	if (!ret)
 	{
diff --git a/src/p_slopes.c b/src/p_slopes.c
index 5a6874196c560e45f04b4c6f4164e9de707ec1e7..3cdbd687efefb7cc674cf858468472f5bf9e68cd 100644
--- a/src/p_slopes.c
+++ b/src/p_slopes.c
@@ -584,23 +584,28 @@ static pslope_t *P_NewVertexSlope(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flag
 //
 void P_CopySectorSlope(line_t *line)
 {
-   sector_t *fsec = line->frontsector;
-   int i, special = line->special;
+	sector_t *fsec = line->frontsector;
+	int i, special = line->special;
 
-   // Check for copy linedefs
-   for(i = -1; (i = P_FindSectorFromLineTag(line, i)) >= 0;)
-   {
-      sector_t *srcsec = sectors + i;
+	// Check for copy linedefs
+	for (i = -1; (i = P_FindSectorFromLineTag(line, i)) >= 0;)
+	{
+		sector_t *srcsec = sectors + i;
+
+		if ((special - 719) & 1 && !fsec->f_slope && srcsec->f_slope)
+			fsec->f_slope = srcsec->f_slope; //P_CopySlope(srcsec->f_slope);
+		if ((special - 719) & 2 && !fsec->c_slope && srcsec->c_slope)
+			fsec->c_slope = srcsec->c_slope; //P_CopySlope(srcsec->c_slope);
+	}
 
-      if((special - 719) & 1 && !fsec->f_slope && srcsec->f_slope)
-         fsec->f_slope = srcsec->f_slope; //P_CopySlope(srcsec->f_slope);
-      if((special - 719) & 2 && !fsec->c_slope && srcsec->c_slope)
-         fsec->c_slope = srcsec->c_slope; //P_CopySlope(srcsec->c_slope);
-   }
+	fsec->hasslope = true;
 
-   fsec->hasslope = true;
+	// if this is an FOF control sector, make sure any target sectors also are marked as having slopes
+	if (fsec->numattached)
+		for (i = 0; i < (int)fsec->numattached; i++)
+			sectors[fsec->attached[i]].hasslope = true;
 
-   line->special = 0; // Linedef was use to set slopes, it finished its job, so now make it a normal linedef
+	line->special = 0; // Linedef was use to set slopes, it finished its job, so now make it a normal linedef
 }
 
 //
diff --git a/src/p_spec.c b/src/p_spec.c
index e47b5cc036edf8a44657666479ff13ac612bfc09..f04a5c700710db5d653a88b71f7ff7e7ba26099a 100644
--- a/src/p_spec.c
+++ b/src/p_spec.c
@@ -5745,6 +5745,10 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f
 	// Add slopes
 	ffloor->t_slope = &sec2->c_slope;
 	ffloor->b_slope = &sec2->f_slope;
+	// mark the target sector as having slopes, if the FOF has any of its own
+	// (this fixes FOF slopes glitching initially at level load in software mode)
+	if (sec2->hasslope)
+		sec->hasslope = true;
 #endif
 
 	if ((flags & FF_SOLID) && (master->flags & ML_EFFECT1)) // Block player only
diff --git a/src/w_wad.c b/src/w_wad.c
index a0f93a14b32b104856f084ee3dacd8b1a12d5ac1..7ef62aabc9bf7a24147309b6bde5b83829085797 100644
--- a/src/w_wad.c
+++ b/src/w_wad.c
@@ -347,7 +347,6 @@ static restype_t ResourceFileDetect (const char* filename)
 static lumpinfo_t* ResGetLumpsStandalone (FILE* handle, UINT16* numlumps, const char* lumpname)
 {
 	lumpinfo_t* lumpinfo = Z_Calloc(sizeof (*lumpinfo), PU_STATIC, NULL);
-	lumpinfo = Z_Calloc(sizeof (*lumpinfo), PU_STATIC, NULL);
 	lumpinfo->position = 0;
 	fseek(handle, 0, SEEK_END);
 	lumpinfo->size = ftell(handle);