added check on persistent undo