diff --git a/src/com/android/launcher2/Alarm.java b/src/com/android/launcher2/Alarm.java
index 38ff367..7cd21c3 100644
--- a/src/com/android/launcher2/Alarm.java
+++ b/src/com/android/launcher2/Alarm.java
@@ -28,6 +28,7 @@
 
     private Handler mHandler;
     private OnAlarmListener mAlarmListener;
+    private boolean mAlarmPending = false;
 
     public Alarm() {
         mHandler = new Handler();
@@ -41,6 +42,7 @@
     // it's overwritten and only the new alarm setting is used
     public void setAlarm(long millisecondsInFuture) {
         long currentTime = System.currentTimeMillis();
+        mAlarmPending = true;
         mAlarmTriggerTime = currentTime + millisecondsInFuture;
         if (!mWaitingForCallback) {
             mHandler.postDelayed(this, mAlarmTriggerTime - currentTime);
@@ -50,6 +52,7 @@
 
     public void cancelAlarm() {
         mAlarmTriggerTime = 0;
+        mAlarmPending = false;
     }
 
     // this is called when our timer runs out
@@ -63,12 +66,17 @@
                 mHandler.postDelayed(this, Math.max(0, mAlarmTriggerTime - currentTime));
                 mWaitingForCallback = true;
             } else {
+                mAlarmPending = false;
                 if (mAlarmListener != null) {
                     mAlarmListener.onAlarm(this);
                 }
             }
         }
     }
+
+    public boolean alarmPending() {
+        return mAlarmPending;
+    }
 }
 
 interface OnAlarmListener {
diff --git a/src/com/android/launcher2/Folder.java b/src/com/android/launcher2/Folder.java
index 780d0ed..652c8b0 100644
--- a/src/com/android/launcher2/Folder.java
+++ b/src/com/android/launcher2/Folder.java
@@ -91,7 +91,6 @@
     private int[] mTargetCell = new int[2];
     private int[] mPreviousTargetCell = new int[2];
     private int[] mEmptyCell = new int[2];
-    private int[] mTempXY = new int[2];
     private Alarm mReorderAlarm = new Alarm();
     private Alarm mOnExitAlarm = new Alarm();
     private TextView mFolderName;
@@ -99,10 +98,10 @@
     private Rect mHitRect = new Rect();
     private Rect mTempRect = new Rect();
     private boolean mFirstOpen = true;
-
-    // Internal variable to track whether the folder was destroyed due to only a single
-    // item remaining
-    private boolean mDestroyed = false;
+    private boolean mDragInProgress = false;
+    private boolean mDeleteFolderOnDropCompleted = false;
+    private boolean mSuppressFolderDeletion = false;
+    private boolean mItemAddedBackToSelf = false;
 
     private boolean mIsEditingName = false;
     private InputMethodManager mInputMethodManager;
@@ -221,6 +220,8 @@
 
             mContent.removeView(mCurrentDragView);
             mInfo.remove(mCurrentDragInfo);
+            mDragInProgress = true;
+            mItemAddedBackToSelf = false;
         }
         return true;
     }
@@ -660,20 +661,38 @@
     }
 
     public void onDropCompleted(View target, DragObject d, boolean success) {
+        if (success) {
+            if (mDeleteFolderOnDropCompleted && !mItemAddedBackToSelf) {
+                replaceFolderWithFinalItem();
+            }
+        } else {
+            // The drag failed, we need to return the item to the folder
+            mFolderIcon.onDrop(d);
+
+            // We're going to trigger a "closeFolder" which may occur before this item has
+            // been added back to the folder -- this could cause the folder to be deleted
+            if (mOnExitAlarm.alarmPending()) {
+                mSuppressFolderDeletion = true;
+            }
+        }
+
+        if (target != this) {
+            if (mOnExitAlarm.alarmPending()) {
+                mOnExitAlarm.cancelAlarm();
+                completeDragExit();
+            }
+        }
+        mDeleteFolderOnDropCompleted = false;
+        mDragInProgress = false;
+        mItemAddedBackToSelf = false;
         mCurrentDragInfo = null;
         mCurrentDragView = null;
         mSuppressOnAdd = false;
-        if (target != this) {
-            mOnExitAlarm.cancelAlarm();
-            completeDragExit();
-        }
+    }
 
-        if (!success) {
-            if (!mDestroyed) {
-                mFolderIcon.onDrop(d);
-            } else {
-                // TODO: if the folder was removed, recreate it
-            }
+    public void notifyDrop() {
+        if (mDragInProgress) {
+            mItemAddedBackToSelf = true;
         }
     }
 
@@ -839,14 +858,18 @@
             mRearrangeOnClose = false;
         }
         if (getItemCount() <= 1) {
-            replaceFolderWithFinalItem();
+            if (!mDragInProgress && !mSuppressFolderDeletion) {
+                replaceFolderWithFinalItem();
+            } else if (mDragInProgress) {
+                mDeleteFolderOnDropCompleted = true;
+            }
         }
+        mSuppressFolderDeletion = false;
     }
 
     private void replaceFolderWithFinalItem() {
         ItemInfo finalItem = null;
 
-        mDestroyed = true;
         if (getItemCount() == 1) {
             finalItem = mInfo.contents.get(0);
         }
diff --git a/src/com/android/launcher2/FolderIcon.java b/src/com/android/launcher2/FolderIcon.java
index 8cf3fa7..b6b027a 100644
--- a/src/com/android/launcher2/FolderIcon.java
+++ b/src/com/android/launcher2/FolderIcon.java
@@ -329,8 +329,16 @@
         if (to == null) {
             to = new Rect();
             Workspace workspace = mLauncher.getWorkspace();
+            // Set cellLayout and this to it's final state to compute final animation locations
             workspace.setFinalTransitionTransform((CellLayout) getParent().getParent());
+            float scaleX = getScaleX();
+            float scaleY = getScaleY();
+            setScaleX(1.0f);
+            setScaleY(1.0f);
             scaleRelativeToDragLayer = dragLayer.getDescendantRectRelativeToSelf(this, to);
+            // Finished computing final animation locations, restore current state
+            setScaleX(scaleX);
+            setScaleY(scaleY);
             workspace.resetTransitionTransform((CellLayout) getParent().getParent());
         }
 
@@ -362,6 +370,7 @@
         } else {
             item = (ShortcutInfo) d.dragInfo;
         }
+        mFolder.notifyDrop();
         onDrop(item, d.dragView, null, 1.0f, mInfo.contents.size(), d.postAnimationRunnable);
     }
 
