diff --git a/uuid_link.module b/uuid_link.module
index abe5e82..78a6b6d 100644
--- a/uuid_link.module
+++ b/uuid_link.module
@@ -104,7 +104,7 @@ function uuid_link_get_link_type_name() {
  */
 function uuid_link_token_info() {
   $type = array(
-    'name' => t('UUID Link'), 
+    'name' => t('UUID Link'),
     'description' => t('UUID Link tokens.'),
     'needs-data' => 'uuid-link',
   );
@@ -113,14 +113,14 @@ function uuid_link_token_info() {
   $tokens = array();
   foreach ($entity_types as $entity_type => $entity_type_info) {
     $tokens[$entity_type] = array(
-      'name' => t('UUID Link @entity', array('@entity' => $entity_type_info['label'])), 
+      'name' => t('UUID Link @entity', array('@entity' => $entity_type_info['label'])),
       'description' => t('Translates into an URL to the @entity entity matching the UUID.', array('@entity' => $entity_type_info['label'])),
       'dynamic' => TRUE,
     );
   }
 
   return array(
-    'types' => array('uuid-link' => $type), 
+    'types' => array('uuid-link' => $type),
     'tokens' => array('uuid-link' => $tokens),
   );
 }
@@ -134,7 +134,7 @@ function uuid_link_tokens($type, $tokens, array $data = array(), array $options
   }
 
   static $seen_uuids = array();
-  static $replacements = array();
+  $replacements = array();
 
   $entity_types = entity_get_info();
   foreach ($entity_types as $entity_type => $info) {
@@ -149,16 +149,15 @@ function uuid_link_tokens($type, $tokens, array $data = array(), array $options
         }
 
         if ($entity_type == 'node') {
-          // We create a dummy node with only nid and language, as an attempt
-          // to get a working URL for the node.
-          $dummy_node = db_select('node', 'n')
-            ->fields('n', array('nid', 'language'))
+          $entity = db_select('node', 'n')
+            ->fields('n', array('nid', 'language', 'type'))
             ->condition($info['entity keys']['uuid'], $uuid)
             ->execute()
             ->fetchObject();
 
-          if (!empty($dummy_node)) {
-            $replacements[$original] = _uuid_link_entity_url(node_uri($dummy_node), $dummy_node);
+          if (!empty($entity)) {
+            $path = entity_uri($entity_type, $entity);
+            $replacements[$original] = url($path['path'], $options);
             continue;
           }
         }
@@ -183,7 +182,8 @@ function uuid_link_tokens($type, $tokens, array $data = array(), array $options
         }
 
         if (!empty($entity)) {
-          $replacements[$original] = uuid_link_entity_url($entity_type, $entity);
+          $path = entity_uri($entity_type, $entity);
+          $replacements[$original] = url($path['path'], $options);
         }
         else {
           // Set link URL to this hash, so the link tag can be removed later
@@ -255,7 +255,11 @@ function uuid_link_filter_info() {
 function uuid_link_filter_process($text, $filter, $format, $langcode, $cache, $cache_id) {
   // Replace uuid-link tokens tokens.
   $data = array('uuid-link' => array());
-  $text = token_replace($text, $data);
+  $languages = language_list();
+  $options = array(
+    'language' => (isset($languages[$langcode])) ? $languages[$langcode] : 'und',
+  );
+  $text = token_replace($text, $data, $options);
 
   // Remove tags for links to content that no longer exists. Check the existence
   // of the #uuid-link-not-found before doing this expensive job.
@@ -283,7 +287,7 @@ function uuid_link_filter_process($text, $filter, $format, $langcode, $cache, $c
 function uuid_link_autocomplete($type, $string = '') {
   $matches = array();
   $entity_type = entity_get_info($type);
-  if (!empty($string) && !empty($entity_type['entity keys']['label'])) { 
+  if (!empty($string) && !empty($entity_type['entity keys']['label'])) {
     $label_key = $entity_type['entity keys']['label'];
     $query = new EntityFieldQuery();
     $query->entityCondition('entity_type', $type)
