Resolved problem after modifying add-documents method and some little bugs