diff --git includes/command.inc includes/command.inc
index d489aa1..f34a973 100644
--- includes/command.inc
+++ includes/command.inc
@@ -97,10 +97,7 @@ function drush_get_commands() {
         if ($command['callback'] != 'drush_command') {
           $required_command_prefix = 'drush_' . $commandfile . '_';
           if ((substr($command['callback'], 0, strlen($required_command_prefix)) == $required_command_prefix)) {
-            if ($commandfile = substr($command['callback'], 6, strlen($commandfile))) {
-              $command['command-hook'] = substr($command['callback'], 6);
-            }
-            else {
+            if ($key != str_replace("_", "-", substr($command['callback'], -strlen($key)))) {
               $command['command-hook'] = substr($command['callback'], strlen($required_command_prefix));
             }
             $command['callback'] = 'drush_command';
