Fixed a wrong return value in the addDocument operation