avoid strange error where the document content disappears before save