diff --git a/src/dehacked.c b/src/dehacked.c
index 7d6c42ac01fbeecd5adb9bcdf13911f00848e6fb..426a4bb6c8c71365c1c625112b5175733c00cb41 100644
--- a/src/dehacked.c
+++ b/src/dehacked.c
@@ -868,6 +868,8 @@ static void readspriteframe(MYFILE *f, spriteinfo_t *sprinfo, UINT8 frame)
 				sprinfo->pivot[frame].x = value;
 			else if (fastcmp(word, "YPIVOT"))
 				sprinfo->pivot[frame].y = value;
+			else if (fastcmp(word, "ROTAXIS"))
+				sprinfo->pivot[frame].rotaxis = value;
 #endif
 			else
 			{
@@ -893,6 +895,11 @@ static void readspriteinfo(MYFILE *f, INT32 num, boolean sprite2)
 	spriteinfo_t *info = Z_Calloc(sizeof(spriteinfo_t), PU_STATIC, NULL);
 	info->available = true;
 
+#ifdef ROTSPRITE
+	if ((sprites != NULL) && (!sprite2))
+		R_FreeSingleRotSprite(&sprites[num]);
+#endif
+
 	do
 	{
 		lastline = f->curpos;
@@ -1006,7 +1013,7 @@ static void readspriteinfo(MYFILE *f, INT32 num, boolean sprite2)
 					break;
 				}
 
-				// read sprite frame and store it on the spriteinfo_t struct
+				// read sprite frame and store it in the spriteinfo_t struct
 				readspriteframe(f, info, frame);
 				if (sprite2)
 				{
@@ -1018,8 +1025,12 @@ static void readspriteinfo(MYFILE *f, INT32 num, boolean sprite2)
 					}
 					for (i = 0; i < foundskins; i++)
 					{
-						skin_t *skin = &skins[skinnumbers[i]];
+						size_t skinnum = skinnumbers[i];
+						skin_t *skin = &skins[skinnum];
 						spriteinfo_t *sprinfo = skin->sprinfo;
+#ifdef ROTSPRITE
+						R_FreeSkinRotSprite(skinnum);
+#endif
 						M_Memcpy(&sprinfo[num], info, sizeof(spriteinfo_t));
 					}
 				}
diff --git a/src/lua_infolib.c b/src/lua_infolib.c
index 6f300cd91493bc9a5a92f130fa213b40480fc036..bee1d20ec3237ff70710bcd8ff4a33beef54c63d 100644
--- a/src/lua_infolib.c
+++ b/src/lua_infolib.c
@@ -269,7 +269,7 @@ static int lib_getSpriteInfo(lua_State *L)
 #ifdef ROTSPRITE
 static int PopPivotSubTable(spriteframepivot_t *pivot, lua_State *L, int stk, int idx)
 {
-	int ok = 0;
+	int okcool = 0;
 	switch (lua_type(L, stk))
 	{
 		case LUA_TTABLE:
@@ -312,14 +312,14 @@ static int PopPivotSubTable(spriteframepivot_t *pivot, lua_State *L, int stk, in
 					pivot[idx].rotaxis = (UINT8)value;
 				else if (ikey == -1 && (key != NULL))
 					FIELDERROR("pivot key", va("invalid option %s", key));
-				ok = 1;
+				okcool = 1;
 				lua_pop(L, 1);
 			}
 			break;
 		default:
 			TYPEERROR("sprite pivot", LUA_TTABLE, lua_type(L, stk))
 	}
-	return ok;
+	return okcool;
 }
 
 static int PopPivotTable(spriteinfo_t *info, lua_State *L, int stk)
@@ -376,7 +376,11 @@ static int lib_setSpriteInfo(lua_State *L)
 		UINT32 i = luaL_checkinteger(L, 1);
 		if (i == 0 || i >= NUMSPRITES)
 			return luaL_error(L, "spriteinfo[] index %d out of range (1 - %d)", i, NUMSPRITES-1);
-		info = &spriteinfo[i]; // get the sfxinfo to assign to.
+#ifdef ROTSPRITE
+		if (sprites != NULL)
+			R_FreeSingleRotSprite(&sprites[i]);
+#endif
+		info = &spriteinfo[i]; // get the spriteinfo to assign to.
 	}
 	luaL_checktype(L, 2, LUA_TTABLE); // check that we've been passed a table.
 	lua_remove(L, 1); // pop sprite num, don't need it any more.
@@ -467,6 +471,9 @@ static int spriteinfo_set(lua_State *L)
 	lua_settop(L, 1); // leave only one value
 
 #ifdef ROTSPRITE
+	if (sprites != NULL)
+		R_FreeSingleRotSprite(&sprites[sprinfo-spriteinfo]);
+
 	if (fastcmp(field, "pivot"))
 	{
 		// pivot[] is a table
@@ -597,7 +604,7 @@ static int framepivot_set(lua_State *L)
 	else if (fastcmp("y", field))
 		framepivot->y = luaL_checkinteger(L, 3);
 	else if (fastcmp("rotaxis", field))
-		framepivot->rotaxis = (rotaxis_t)(luaL_checkinteger(L, 3));
+		framepivot->rotaxis = luaL_checkinteger(L, 3);
 	else
 		return luaL_error(L, va("Field %s does not exist in spriteframepivot_t", field));
 
diff --git a/src/p_setup.c b/src/p_setup.c
index 73dcf37fc31ebcfdbcef15d7ba74ace47c38b8d6..2a10f7548f42ac9b06db48e2a008b686a8752b5c 100644
--- a/src/p_setup.c
+++ b/src/p_setup.c
@@ -3510,20 +3510,6 @@ boolean P_AddWadFile(const char *wadfilename)
 	if (!mapsadded)
 		CONS_Printf(M_GetText("No maps added\n"));
 
-#ifdef ROTSPRITE
-	for (i = 0; i < NUMSPRITES; i++)
-		R_FreeRotSprite(&sprites[i]);
-	for (i = 0; i < MAXSKINS; i++)
-	{
-		spritedef_t *skinsprites = skins[i].sprites;
-		for (j = 0; j < NUMPLAYERSPRITES*2; j++)
-		{
-			R_FreeRotSprite(skinsprites);
-			skinsprites++;
-		}
-	}
-#endif
-
 	R_LoadSpriteInfoLumps(wadnum, numlumps);
 
 #ifdef HWRENDER
diff --git a/src/r_patch.c b/src/r_patch.c
index 65c7332491adc9b2d8ace7ee61614d61ebd37df9..cee189670a3afaa6d75a107135e1b49bfb943301 100644
--- a/src/r_patch.c
+++ b/src/r_patch.c
@@ -940,6 +940,11 @@ static void R_ParseSpriteInfo(boolean spr2)
 	info = Z_Calloc(sizeof(spriteinfo_t), PU_STATIC, NULL);
 	info->available = true;
 
+#ifdef ROTSPRITE
+	if ((sprites != NULL) && (!spr2))
+		R_FreeSingleRotSprite(&sprites[sprnum]);
+#endif
+
 	// Left Curly Brace
 	sprinfoToken = M_GetToken(NULL);
 	if (sprinfoToken == NULL)
@@ -997,8 +1002,12 @@ static void R_ParseSpriteInfo(boolean spr2)
 						I_Error("Error parsing SPRTINFO lump: No skins specified in this sprite2 definition");
 					for (i = 0; i < foundskins; i++)
 					{
-						skin_t *skin = &skins[skinnumbers[i]];
+						size_t skinnum = skinnumbers[i];
+						skin_t *skin = &skins[skinnum];
 						spriteinfo_t *sprinfo = skin->sprinfo;
+#ifdef ROTSPRITE
+						R_FreeSkinRotSprite(skinnum);
+#endif
 						M_Memcpy(&sprinfo[spr2num], info, sizeof(spriteinfo_t));
 					}
 				}
@@ -1293,11 +1302,11 @@ void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, sp
 }
 
 //
-// R_FreeRotSprite
+// R_FreeSingleRotSprite
 //
-// Free sprite rotation data from memory.
+// Free sprite rotation data from memory, for a single spritedef.
 //
-void R_FreeRotSprite(spritedef_t *spritedef)
+void R_FreeSingleRotSprite(spritedef_t *spritedef)
 {
 	UINT8 frame;
 	INT32 rot, ang;
@@ -1343,4 +1352,22 @@ void R_FreeRotSprite(spritedef_t *spritedef)
 		}
 	}
 }
+
+//
+// R_FreeSkinRotSprite
+//
+// Free sprite rotation data from memory, for a skin.
+// Calls R_FreeSingleRotSprite.
+//
+void R_FreeSkinRotSprite(size_t skinnum)
+{
+	size_t i;
+	skin_t *skin = &skins[skinnum];
+	spritedef_t *skinsprites = skin->sprites;
+	for (i = 0; i < NUMPLAYERSPRITES*2; i++)
+	{
+		R_FreeSingleRotSprite(skinsprites);
+		skinsprites++;
+	}
+}
 #endif
diff --git a/src/r_patch.h b/src/r_patch.h
index fe2bba34b0cee7532a2f6b0518ac104dcc5aa2d5..23ac025f6909b6739b079927f5b3882e8506aa23 100644
--- a/src/r_patch.h
+++ b/src/r_patch.h
@@ -67,7 +67,8 @@ void R_ParseSPRTINFOLump(UINT16 wadNum, UINT16 lumpNum);
 // rotsprite
 #ifdef ROTSPRITE
 void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, spriteframe_t *sprframe, INT32 rot, UINT8 flip);
-void R_FreeRotSprite(spritedef_t *spritedef);
+void R_FreeSingleRotSprite(spritedef_t *spritedef);
+void R_FreeSkinRotSprite(size_t skinnum);
 extern fixed_t cosang2rad[ROTANGLES];
 extern fixed_t sinang2rad[ROTANGLES];
 #endif
diff --git a/src/r_things.c b/src/r_things.c
index e0dd804a79ab0ddbf2306b5586ccab40d3e518df..1225a8a067dc6b1f27e1bcb280c36e7435d65c3c 100644
--- a/src/r_things.c
+++ b/src/r_things.c
@@ -244,7 +244,7 @@ static boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef,
 	if (spritedef->numframes) // (then spriteframes is not null)
 	{
 #ifdef ROTSPRITE
-		R_FreeRotSprite(spritedef);
+		R_FreeSingleRotSprite(spritedef);
 #endif
 		// copy the already defined sprite frames
 		M_Memcpy(sprtemp, spritedef->spriteframes,
@@ -394,7 +394,7 @@ static boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef,
 		spritedef->numframes < maxframe)   // more frames are defined ?
 	{
 #ifdef ROTSPRITE
-		R_FreeRotSprite(spritedef);
+		R_FreeSingleRotSprite(spritedef);
 #endif
 		Z_Free(spritedef->spriteframes);
 		spritedef->spriteframes = NULL;