fixing bug where the undo tree is larger than allowed, after some hours of use
fixing bug where the undo tree is larger than allowed, after some hours of use