diff --git a/linkweights.module b/linkweights.module
index 8184144..5e0d88e 100644
--- a/linkweights.module
+++ b/linkweights.module
@@ -65,11 +65,11 @@ function linkweights_perm() {
  * Implementation of hook_link_alter().
  *
  */
-function linkweights_link_alter(&$links, $node) {
+function linkweights_link_alter($links, $node) {
   $lweights = db_query("SELECT * FROM {linkweights} WHERE nodetype='%s'", $node->type);
   //set default to 0
   foreach ($links as $link) {
-    $links[$key]['weight'] = 0;
+    $link[$key]['weight'] = 0;
   }
   while ($val = db_fetch_array($lweights)) {
     if (array_key_exists($val['link'], $links)) {
@@ -77,6 +77,8 @@ function linkweights_link_alter(&$links, $node) {
     }
   }
   uasort($links, '_linkweights_link_cmp');
+ 
+  return $links;
 }
 
 /**
@@ -91,4 +93,4 @@ function _linkweights_link_cmp($a, $b) {
 
 function linkweights_nodetype_load($nodetype) {
   return $nodetype;
-}
\ No newline at end of file
+}
