handle cases if the document does not exist