fix two bugs in tfidf calculation