diff --git a/inc/plugincontroller.class.php b/inc/plugincontroller.class.php
index 968d47a5c1c7db5cd6970ad72451c571325306df..0b4041a77e28f3990d2f45e9de387423f1f013bc 100644
--- a/inc/plugincontroller.class.php
+++ b/inc/plugincontroller.class.php
@@ -97,6 +97,9 @@ class Doku_Plugin_Controller {
             $inf = confToHash(DOKU_PLUGIN."$dir/plugin.info.txt");
             if($inf['base'] && $inf['base'] != $plugin){
                 msg(sprintf("Plugin installed incorrectly. Rename plugin directory '%s' to '%s'.", hsc($plugin), hsc($inf['base'])), -1);
+            } elseif (preg_match('/^'.DOKU_PLUGIN_NAME_REGEX.'$/', $plugin) !== 1) {
+                msg(sprintf("Plugin name '%s' is not a valid plugin name, only the characters a-z and 0-9 are allowed. ".
+                                'Maybe the plugin has been installed in the wrong directory?', hsc($plugin)), -1);
             }
             return null;
         }
@@ -156,10 +159,6 @@ class Doku_Plugin_Controller {
                 } else {
                     $all_plugins[$plugin] = 1;
                 }
-                if ($all_plugins[$plugin] == 1 && preg_match('/^'.DOKU_PLUGIN_NAME_REGEX.'$/', $plugin) !== 1) {
-                    msg(sprintf("Plugin name '%s' is not a valid plugin name, only the characters a-z and 0-9 are allowed. ".
-                                 'Maybe the plugin has been installed in the wrong directory?', hsc($plugin)), -1);
-                }
             }
             $this->tmp_plugins = $all_plugins;
             if (!file_exists($this->last_local_config_file)) {