diff --git a/includes/menu.inc b/includes/menu.inc
index a92481634f2ed5c5a2c70d626b6d039d25548ccd..e6d96c39242799ab5d9820f6984caed053e8259e 100644
--- a/includes/menu.inc
+++ b/includes/menu.inc
@@ -1317,19 +1317,15 @@ function menu_navigation_links($menu_name, $level = 0) {
   $links = array();
   foreach ($tree as $item) {
     if (!$item['link']['hidden']) {
+      $class = '';
       $l = $item['link']['localized_options'];
       $l['href'] = $item['link']['href'];
       $l['title'] = $item['link']['title'];
       if ($item['link']['in_active_trail']) {
-        if (empty($l['attributes']['class'])) {
-          $l['attributes']['class'] = 'active-trail';
-        }
-        else {
-          $l['attributes']['class'] .= ' active-trail';
-        }
+        $class = ' active-trail';
       }
-      // Keyed with unique menu id to generate classes from theme_links().
-      $links['menu-' . $item['link']['mlid']] = $l;
+      // Keyed with the unique mlid to generate classes in theme_links().
+      $links['menu-' . $item['link']['mlid'] . $class] = $l;
     }
   }
   return $links;