fixed performance regression in doc update and query