diff --git a/src/deh_lua.c b/src/deh_lua.c
index 0d5f48ce1140fb30f71dda44432796591cf0d277..64fb52fc7423a7486c9d6736762fedd0fcde64ba 100644
--- a/src/deh_lua.c
+++ b/src/deh_lua.c
@@ -62,7 +62,7 @@ static inline int lib_freeslot(lua_State *L)
 			spritenum_t j;
 
 			if (strlen(word) > MAXSPRITENAME)
-				return luaL_error(L, "Sprite name is longer than %s characters\n", sizeu1(strlen(word)));
+				return luaL_error(L, "Sprite name is longer than %d characters\n", MAXSPRITENAME);
 
 			for (j = SPR_FIRSTFREESLOT; j <= SPR_LASTFREESLOT; j++)
 			{
diff --git a/src/deh_soc.c b/src/deh_soc.c
index 6e4c087d549c64c19dc87d9d73699139cb127def..d1643fd4eda3b8f141b410ab57286c04f90381fe 100644
--- a/src/deh_soc.c
+++ b/src/deh_soc.c
@@ -441,7 +441,7 @@ void readfreeslots(MYFILE *f)
 			else if (fastcmp(type, "SPR"))
 			{
 				if (strlen(word) > MAXSPRITENAME)
-					I_Error("Sprite name is longer than %s characters\n", sizeu1(strlen(word)));
+					I_Error("Sprite name is longer than %d characters\n", MAXSPRITENAME);
 
 				for (i = SPR_FIRSTFREESLOT; i <= SPR_LASTFREESLOT; i++)
 				{