diff --git a/src/uncategorized/rename.tw b/src/uncategorized/rename.tw
index a6f1e43e5bfbf01a66092b3907ad53c3c7de8057..886bb09b3e509b5c0761a6e9f331d49d01edf793 100644
--- a/src/uncategorized/rename.tw
+++ b/src/uncategorized/rename.tw
@@ -35,9 +35,8 @@
 <</if>>
 
 <<set _insultingName = 0>>
-<<if $oldName != $activeSlave.slaveName>>
-	<<set _toSearch = $activeSlave.slaveName>>
-	<<set _toSearch = _toSearch.toLowerCase();>>
+<<if $oldName != $activeSlave.slaveName && typeof $activeSlave.slaveName == "string">>
+	<<set _toSearch = $activeSlave.slaveName.toLowerCase()>>
 	<<for $i = 0; $i < setup.badWords.length; $i++>>
 	<<if _toSearch.indexOf(setup.badWords[$i]) != -1>>
 		<<set _insultingName = 1>>
@@ -46,9 +45,8 @@
 	<</for>>
 <</if>>
 <<if !_insultingName>>
-<<if $oldSurname != $activeSlave.slaveSurname>>
-	<<set _toSearch = $activeSlave.slaveSurname>>
-	<<set _toSearch = _toSearch.toLowerCase();>>
+<<if $oldSurname != $activeSlave.slaveSurname && typeof $activeSlave.slaveSurname == "string">>
+	<<set _toSearch = $activeSlave.slaveSurname.toLowerCase()>>
 	<<for $i = 0; $i < setup.badWords.length; $i++>>
 	<<if _toSearch.indexOf(setup.badWords[$i]) != -1>>
 		<<set _insultingName = 1>>