Fixed problems for UndoCommand.