test saving invalid document