--- nodereference_url.module	2011-04-27 22:08:01.000000000 +0400
+++ nodereference_url.module	2011-05-04 16:08:43.000000000 +0400
@@ -70,18 +70,19 @@ function nodereference_url_build_all_lin
   foreach ($fields as $field_name => $field) {
     foreach (_nodereference_url_field_instances($field_name) as $target_type => $instance) {
       if ($instance['widget']['type'] == 'nodereference_url') {
-        $instances[$field_name] = $instance;
-        $instances[$field_name]['target_type'] = $target_type;
+        $instances[$field_name][$target_type] = $instance;
       }
     }
   }
 
   $alt_format = count($instances) > 1;
-  foreach ($instances as $field_name => $instance) {
-    $link_settings = $instance['widget']['node_link'];
-    if (($link_settings['teaser'] && $teaser == TRUE) || ($link_settings['full'] && $teaser == FALSE)) {
-      if ($link = nodereference_url_build_link($node, $instance, $teaser, $alt_format)) {
-        $links[$target_type .'_'. $field_name] = $link;
+  foreach ($instances as $field_name => $instances_group) {
+    foreach ($instances_group as $target_type => $instance) {
+      $link_settings = $instance['widget']['node_link'];
+      if (($link_settings['teaser'] && $teaser == TRUE) || ($link_settings['full'] && $teaser == FALSE)) {
+        if ($link = nodereference_url_build_link($node, $instance, $teaser, $alt_format)) {
+          $links[$target_type .'_'. $field_name] = $link;
+        }
       }
     }
   }
