Index: kernel/content/ezcontentfunctioncollection.php
===================================================================
--- kernel/content/ezcontentfunctioncollection.php	(revision 25229)
+++ kernel/content/ezcontentfunctioncollection.php	(working copy)
@@ -946,9 +946,18 @@
                 {
                     $sortingString = '';
                     if ( $sortBy[0] == 'name' )
+                    {
                         $sortingString = 'ezcontentobject.name';
+                        $sortingInfo['attributeTargetSQL'] = ', ' . $sortingString;
+                    }
                     elseif ( $sortBy[0] == 'keyword' )
-                        $sortingString = 'ezkeyword.keyword';
+                    {
+                        if ( $includeDuplicates )
+                            $sortingString = 'ezkeyword.keyword';
+                        else
+                            $sortingString = 'keyword';
+                        $sortingInfo['attributeTargetSQL'] = '';
+                    }
 
                     $sortOrder = true; // true is ascending
                     if ( isset( $sortBy[1] ) )
@@ -969,9 +978,10 @@
                     }
                     else // for unique declaration
                         $sortingInfo['attributeFromSQL']  .= ', ezcontentobject_attribute a1';
-
                 } break;
             }
+
+            $sqlTarget .= $sortingInfo['attributeTargetSQL'];
         }
         else
         {
