fix bug on document_rec and fields_rec