Fixed bug for undo / redo