Fix updating document  hash while saving