diff --git a/src/deh_lua.c b/src/deh_lua.c
index 3d6d8b455292639d58b0d63f10039decec0b7f62..0d5f48ce1140fb30f71dda44432796591cf0d277 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 %d characters\n", strlen(word));
+				return luaL_error(L, "Sprite name is longer than %s characters\n", sizeu1(strlen(word)));
 
 			for (j = SPR_FIRSTFREESLOT; j <= SPR_LASTFREESLOT; j++)
 			{
diff --git a/src/deh_soc.c b/src/deh_soc.c
index 26959845981d3dc96fc071128f28f99d6262cdd0..6e4c087d549c64c19dc87d9d73699139cb127def 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 %d characters\n", strlen(word));
+					I_Error("Sprite name is longer than %s characters\n", sizeu1(strlen(word)));
 
 				for (i = SPR_FIRSTFREESLOT; i <= SPR_LASTFREESLOT; i++)
 				{