diff --git a/modules/system.eval.inc b/modules/system.eval.inc
index 0de887c..9172478 100644
--- a/modules/system.eval.inc
+++ b/modules/system.eval.inc
@@ -189,7 +189,13 @@ class RulesTokenEvaluator extends RulesDataInputEvaluator {
     $whole_text = is_array($text) ? implode('', $text) : $text;
     foreach (token_scan($whole_text) as $var_name => $tokens) {
       $var_name = str_replace('-', '_', $var_name);
-      if (isset($var_info[$var_name]) && ($token_type = _rules_system_token_map_type($var_info[$var_name]['type']))) {
+      if (isset($var_info[$var_name]) && $var_info[$var_name]['type'] == 'entity' && ($entity = $state->get($var_name))) {
+        // We have the an entity but don't know its entity type yet.
+        $token_type = _rules_system_token_map_type($entity->type());
+        $data = rules_unwrap_data(array($token_type => $entity->value()), array($token_type => $var_info[$var_name]));
+        $replacements += token_generate($token_type, $tokens, $data, $options);
+      }
+      else if (isset($var_info[$var_name]) && ($token_type = _rules_system_token_map_type($var_info[$var_name]['type']))) {
         // We have to key $data with the type token uses for the variable.
         $data = rules_unwrap_data(array($token_type => $state->get($var_name)), array($token_type => $var_info[$var_name]));
         $replacements += token_generate($token_type, $tokens, $data, $options);
