fixed bug in topic modeling algorithm