fixed add_document