[Doc-SIG] Minor bugfix/optimisation for doc_collect