diff --git a/karaf/deployer/filemonitor/src/main/java/org/apache/felix/karaf/deployer/filemonitor/FileMonitor.java b/karaf/deployer/filemonitor/src/main/java/org/apache/felix/karaf/deployer/filemonitor/FileMonitor.java
index f12ac05..e3a18c8 100644
--- a/karaf/deployer/filemonitor/src/main/java/org/apache/felix/karaf/deployer/filemonitor/FileMonitor.java
+++ b/karaf/deployer/filemonitor/src/main/java/org/apache/felix/karaf/deployer/filemonitor/FileMonitor.java
@@ -76,7 +76,7 @@
     public final static String SCAN_INTERVAL = "org.apache.felix.karaf.filemonitor.scanInterval";
     public final static String PREFERENCE_KEY = "FileMonitor";
 
-    protected static final String ALIAS_KEY = "_alias_factory_pid";
+    protected static final String FILENAME = "org.apache.felix.karaf.filemonitor.filename";
 
     private static final Log LOGGER = LogFactory.getLog(FileMonitor.class);
 
@@ -447,10 +447,7 @@
                 String[] pid = parsePid(file);
                 Hashtable<Object, Object> hashtable = new Hashtable<Object, Object>();
                 hashtable.putAll(properties);
-                if (pid[1] != null) {
-                    hashtable.put(ALIAS_KEY, pid[1]);
-                }
-
+                hashtable.put(FILENAME, file.getName());
                 Configuration config = getConfiguration(pid[0], pid[1]);
                 if (config.getBundleLocation() != null) {
                     config.setBundleLocation(null);
@@ -484,18 +481,32 @@
         config.delete();
     }
 
-    protected Configuration getConfiguration(String pid, String factoryPid) throws IOException,
-        InvalidSyntaxException {
-        ConfigurationAdmin configurationAdmin = activator.getConfigurationAdmin();
-        if (factoryPid != null) {
-            Configuration[] configs = configurationAdmin.listConfigurations("(" + ALIAS_KEY + "=" + factoryPid + ")");
-            if (configs == null || configs.length == 0) {
+    protected Configuration getConfiguration(String pid, String factoryPid) throws IOException, InvalidSyntaxException {
+        Configuration oldConfiguration = findExistingConfiguration(pid, factoryPid);
+        if (oldConfiguration != null) {
+            return oldConfiguration;
+        } else {
+            ConfigurationAdmin configurationAdmin = activator.getConfigurationAdmin();
+            if (factoryPid != null) {
                 return configurationAdmin.createFactoryConfiguration(pid, null);
             } else {
-                return configs[0];
+                return configurationAdmin.getConfiguration(pid, null);
             }
-        } else {
-            return configurationAdmin.getConfiguration(pid, null);
+        }
+    }
+
+    protected Configuration findExistingConfiguration(String pid, String factoryPid) throws IOException, InvalidSyntaxException {
+        String suffix = factoryPid == null ? ".cfg" : "-" + factoryPid + ".cfg";
+        ConfigurationAdmin cm = activator.getConfigurationAdmin();
+        String filter = "(" + FILENAME + "=" + pid + suffix + ")";
+        Configuration[] configurations = cm.listConfigurations(filter);
+        if (configurations != null && configurations.length > 0)
+        {
+            return configurations[0];
+        }
+        else
+        {
+            return null;
         }
     }
 
diff --git a/karaf/features/core/src/main/java/org/apache/felix/karaf/features/internal/FeaturesServiceImpl.java b/karaf/features/core/src/main/java/org/apache/felix/karaf/features/internal/FeaturesServiceImpl.java
index a0d3dd5..2a288ac 100644
--- a/karaf/features/core/src/main/java/org/apache/felix/karaf/features/internal/FeaturesServiceImpl.java
+++ b/karaf/features/core/src/main/java/org/apache/felix/karaf/features/internal/FeaturesServiceImpl.java
@@ -66,7 +66,7 @@
  */
 public class FeaturesServiceImpl implements FeaturesService {
 
-    private static final String ALIAS_KEY = "_alias_factory_pid";
+    public static final String CONFIG_KEY = "org.apache.felix.karaf.features.configKey";
 
     private static final Logger LOGGER = LoggerFactory.getLogger(FeaturesServiceImpl.class);
 
@@ -197,9 +197,8 @@
         for (String config : f.getConfigurations().keySet()) {
             Dictionary<String,String> props = new Hashtable<String, String>(f.getConfigurations().get(config));
             String[] pid = parsePid(config);
-            if (pid[1] != null) {
-                props.put(ALIAS_KEY, pid[1]);
-            }
+            String key = (pid[1] == null ? pid[0] : pid[0] + "-" + pid[1]);
+            props.put(CONFIG_KEY, key);
             Configuration cfg = getConfiguration(configAdmin, pid[0], pid[1]);
             if (cfg.getBundleLocation() != null) {
                 cfg.setBundleLocation(null);
@@ -432,15 +431,30 @@
 
     protected Configuration getConfiguration(ConfigurationAdmin configurationAdmin,
                                              String pid, String factoryPid) throws IOException, InvalidSyntaxException {
-        if (factoryPid != null) {
-            Configuration[] configs = configurationAdmin.listConfigurations("(" + ALIAS_KEY + "=" + factoryPid + ")");
-            if (configs == null || configs.length == 0) {
+        Configuration oldConfiguration = findExistingConfiguration(configurationAdmin, pid, factoryPid);
+        if (oldConfiguration != null) {
+            return oldConfiguration;
+        } else {
+            if (factoryPid != null) {
                 return configurationAdmin.createFactoryConfiguration(pid, null);
             } else {
-                return configs[0];
+                return configurationAdmin.getConfiguration(pid, null);
             }
-        } else {
-            return configurationAdmin.getConfiguration(pid, null);
+        }
+    }
+
+    protected Configuration findExistingConfiguration(ConfigurationAdmin configurationAdmin,
+                                                      String pid, String factoryPid) throws IOException, InvalidSyntaxException {
+        String key = (factoryPid == null ? pid : pid + "-" + factoryPid);
+        String filter = "(" + CONFIG_KEY + "=" + key + ")";
+        Configuration[] configurations = configurationAdmin.listConfigurations(filter);
+        if (configurations != null && configurations.length > 0)
+        {
+            return configurations[0];
+        }
+        else
+        {
+            return null;
         }
     }
     
