add fail safe patch for undohist