diff --git a/src/utils/UndoManager.js b/src/utils/UndoManager.js
index cbbda630..0710ef11 100644
--- a/src/utils/UndoManager.js
+++ b/src/utils/UndoManager.js
@@ -123,6 +123,12 @@ const popStackItem = (undoManager, stack, eventType) => {
         undoManager.emit('stack-item-popped', [{ stackItem: result, type: eventType }, undoManager])
       }
     }
+    transaction.changed.forEach((subProps, type) => {
+      // destroy search marker if necessary
+      if (subProps.has(null) && type._searchMarker) {
+        type._searchMarker.length = 0
+      }
+    })
   }, undoManager)
   return result
 }
@@ -151,10 +157,7 @@ export class UndoManager extends Observable {
    * @param {AbstractType<any>|Array<AbstractType<any>>} typeScope Accepts either a single type, or an array of types
    * @param {UndoManagerOptions} options
    */
-  constructor (typeScope, { captureTimeout, deleteFilter = () => true, trackedOrigins = new Set([null]) } = {}) {
-    if (captureTimeout == null) {
-      captureTimeout = 500
-    }
+  constructor (typeScope, { captureTimeout = 500, deleteFilter = () => true, trackedOrigins = new Set([null]) } = {}) {
     super()
     this.scope = typeScope instanceof Array ? typeScope : [typeScope]
     this.deleteFilter = deleteFilter
diff --git a/tests/undo-redo.tests.js b/tests/undo-redo.tests.js
index 63417dc2..2bdab50f 100644
--- a/tests/undo-redo.tests.js
+++ b/tests/undo-redo.tests.js
@@ -53,6 +53,28 @@ export const testUndoText = tc => {
   t.compare(text0.toDelta(), [{ insert: 'b' }, { insert: 'cxy', attributes: { bold: true } }, { insert: 'z' }])
 }
 
+/**
+ * Test case to fix #241
+ * @param {t.TestCase} tc
+ */
+export const testDoubleUndo = tc => {
+  const doc = new Y.Doc()
+  const text = doc.getText()
+  text.insert(0, '1221')
+
+  const manager = new Y.UndoManager(text)
+
+  text.insert(2, '3')
+  text.insert(3, '3')
+
+  manager.undo()
+  manager.undo()
+
+  text.insert(2, '3')
+
+  t.compareStrings(text.toString(), '12321')
+}
+
 /**
  * @param {t.TestCase} tc
  */