GWTII-178:bug fix undo while inserting

(cherry picked from commit 7d169cb)