fixed memory problem of addBOW and computeBOW