diff --git a/nodewords.module b/nodewords.module
index dc8bfc7..001daf4 100644
--- a/nodewords.module
+++ b/nodewords.module
@@ -1171,7 +1171,7 @@ function nodewords_unique_values($text, $separator = ',', $max_items = -1) {
   }
 
   if ($max_items > 0) {
-    $unique_values = array_slice($uniq_values, 0, $max_items);
+    $unique_values = array_slice($unique_values, 0, $max_items);
   }
 
   return implode("$separator", $unique_values);
