Avoid to crash in updateDocumentStatus (#295 #297)