fix bug in Bag-of-Words model