diff --git realname.module realname.module
index ad5afa0..55047dd 100644
--- realname.module
+++ realname.module
@@ -895,6 +895,11 @@ function _realname_make_name(&$account) {
   else {
     $string = $account->name;
   }
+
+  // Removes double spaces in case they are generated by patterns with empty
+  // fields. See http://drupal.org/node/977430
+  $string = preg_replace('/\ +/', ' ', $string);
+
   return html_entity_decode(filter_xss_admin($string));
 }
 
