Fix bug if document has been deleted on repo