fix bug in generating document vectors