Fix and a little rewrite Document-Term matrix function