diff --git a/VolumeManager.cpp b/VolumeManager.cpp
index 1c48932..0388010 100644
--- a/VolumeManager.cpp
+++ b/VolumeManager.cpp
@@ -985,6 +985,19 @@
     return 0;
 }
 
+Volume* VolumeManager::getVolumeForFile(const char *fileName) {
+    VolumeCollection::iterator i;
+
+    for (i = mVolumes->begin(); i != mVolumes->end(); ++i) {
+        const char* mountPoint = (*i)->getMountpoint();
+        if (!strncmp(fileName, mountPoint, strlen(mountPoint))) {
+            return *i;
+        }
+    }
+
+    return NULL;
+}
+
 /**
  * Mounts an image file <code>img</code>.
  */
@@ -1113,7 +1126,7 @@
     }
 
     // Create a string to compare against that has a trailing slash
-    int loopDirLen = sizeof(Volume::LOOPDIR);
+    int loopDirLen = strlen(Volume::LOOPDIR);
     char loopDir[loopDirLen + 2];
     strcpy(loopDir, Volume::LOOPDIR);
     loopDir[loopDirLen++] = '/';
@@ -1462,25 +1475,35 @@
 }
 
 int VolumeManager::cleanupAsec(Volume *v, bool force) {
-    while(mActiveContainers->size()) {
-        AsecIdCollection::iterator it = mActiveContainers->begin();
+    int rc = unmountAllAsecsInDir(Volume::SEC_ASECDIR_EXT);
+
+    AsecIdCollection toUnmount;
+    // Find the remaining OBB files that are on external storage.
+    for (AsecIdCollection::iterator it = mActiveContainers->begin(); it != mActiveContainers->end();
+            ++it) {
         ContainerData* cd = *it;
-        SLOGI("Unmounting ASEC %s (dependant on %s)", cd->id, v->getMountpoint());
+
         if (cd->type == ASEC) {
-            if (unmountAsec(cd->id, force)) {
-                SLOGE("Failed to unmount ASEC %s (%s)", cd->id, strerror(errno));
-                return -1;
-            }
+            // nothing
         } else if (cd->type == OBB) {
-            if (unmountObb(cd->id, force)) {
-                SLOGE("Failed to unmount OBB %s (%s)", cd->id, strerror(errno));
-                return -1;
+            if (v == getVolumeForFile(cd->id)) {
+                toUnmount.push_back(cd);
             }
         } else {
             SLOGE("Unknown container type %d!", cd->type);
-            return -1;
         }
     }
-    return 0;
+
+    for (AsecIdCollection::iterator it = toUnmount.begin(); it != toUnmount.end(); ++it) {
+        ContainerData *cd = *it;
+        SLOGI("Unmounting ASEC %s (dependant on %s)", cd->id, v->getMountpoint());
+        if (unmountObb(cd->id, force)) {
+            SLOGE("Failed to unmount OBB %s (%s)", cd->id, strerror(errno));
+            rc = -1;
+        }
+    }
+
+    return rc;
+
 }
 
diff --git a/VolumeManager.h b/VolumeManager.h
index 4399b76..198b5a9 100644
--- a/VolumeManager.h
+++ b/VolumeManager.h
@@ -117,6 +117,8 @@
     int unmountObb(const char *fileName, bool force);
     int getObbMountPath(const char *id, char *buffer, int maxlen);
 
+    Volume* getVolumeForFile(const char *fileName);
+
     /* Shared between ASEC and Loopback images */
     int unmountLoopImage(const char *containerId, const char *loopId,
             const char *fileName, const char *mountPoint, bool force);
