Revert "Fixed bug in the UndoRedoHandler"

This reverts commit 22638e1054afc27fd5c46dd8310bda39000e2165.
New UndoRedoHandler fix

This one doesn't seem to crash the application in the process.