Fixed bug in the undo/redo code.