Frequency matrix index bug fixed

Issue where distributions were always inserted from the first index of
the topic fixed