diff --git a/link.module b/link.module
index 16a5fad..f105800 100644
--- a/link.module
+++ b/link.module
@@ -69,7 +69,7 @@ function link_field_instance_settings_form($field, $instance) {
   $form = array(
     '#element_validate' => array('link_field_settings_form_validate'),
   );
-  
+
   $form['validate_url'] = array(
     '#type' => 'checkbox',
     '#title' => t('Validate URL'),
@@ -507,7 +507,7 @@ function _link_sanitize(&$item, $delta, &$field, $instance, &$node) {
 
   // Remove the rel=nofollow for internal links.
   if ($type != LINK_EXTERNAL && strpos($item['attributes']['rel'], 'nofollow') !== FALSE) {
-    $item['attributes']['rel'] = str_replace('nofollow', '', $item['attributes']);
+    $item['attributes']['rel'] = str_replace('nofollow', '', $item['attributes']['rel']);
   }
 
   // Handle "title" link attribute.
@@ -748,12 +748,12 @@ function theme_link_formatter_link_default($vars) {
   $link_options = $vars['element'];
   unset($link_options['element']['title']);
   unset($link_options['element']['url']);
-  
+
   // Issue #1199806 by ss81: Fixes fatal error when the link URl is equal to page URL
   if (isset($link_options['attributes']['class'])) {
     $link_options['attributes']['class'] = array($link_options['attributes']['class']);
   }
-  
+
   // Display a normal link if both title and URL are available.
   if (!empty($vars['element']['title']) && !empty($vars['element']['url'])) {
     return l($vars['element']['title'], $vars['element']['url'], $link_options);
@@ -827,10 +827,10 @@ function theme_link_formatter_link_separate($vars) {
   unset($link_options['element']['title']);
   unset($link_options['element']['url']);
   $title = empty($vars['element']['title']) ? '' : check_plain($vars['element']['title']);
-  
-  /** 
+
+  /**
    * @TODO static html markup looks not very elegant to me (who takes it off?)
-   * needs smarter output solution and an optional title/url seperator (digidog) 
+   * needs smarter output solution and an optional title/url seperator (digidog)
    */
   $output = '';
   $output .= '<div class="link-item '. $class .'">';
@@ -966,7 +966,7 @@ function link_validate_url($text) {
     "&#x00DB;", // Û
     "&#x00FB;", // û
     "&#x0178;", // Ÿ
-    "&#x00FF;", // ÿ 
+    "&#x00FF;", // ÿ
     "&#x00D1;", // Ñ
     "&#x00F1;", // ñ
     "&#x00FE;", // þ
