Fixed undo with newly opened file problem