diff --git a/replace/misc/1.7/states.js b/replace/misc/1.7/states.js
index d934372..a34b5c2 100644
--- a/replace/misc/1.7/states.js
+++ b/replace/misc/1.7/states.js
@@ -291,9 +291,11 @@ states.State = function(state) {
   // Normalize the state name.
   while (true) {
     // Iteratively remove exclamation marks and invert the value.
-    while (this.name.charAt(0) == '!') {
-      this.name = this.name.substring(1);
-      this.invert = !this.invert;
+    if(this.name.charAt){
+      while (this.name.charAt(0) == '!') {
+        this.name = this.name.substring(1);
+        this.invert = !this.invert;
+      }
     }
 
     // Replace the state with its normalized name.
