diff --git a/lib/wed/wed.js b/lib/wed/wed.js
index <HASH>..<HASH> 100644
--- a/lib/wed/wed.js
+++ b/lib/wed/wed.js
@@ -1119,11 +1119,20 @@ oop.implement(Editor, SimpleEventEmitter);
         var it = this._selection_stack.pop();
         if (it instanceof Array)
             this.setCaret(it);  // setCaret() will call _caretChangeEmitter.
-        else {
+        else if (it !== undefined) {
             rangy.restoreSelection(it);
             // Call with a minimal object
             this._caretChangeEmitter();
         }
+        else
+            // Null value means there was no selection, ergo...
+            this.clearSelection();
+    };
+
+    this.clearSelection = function () {
+        this._$fake_caret.remove();
+        this._raw_caret = undefined;
+        rangy.getSelection(this.my_window).removeAllRanges();
     };
 
     var state_to_str = {};
Fixed popSelection to clear the selection when needed.