Fix not always reporting an error message when saving a document