fixed the Undo when Focused bug