fixing problem with topic_id miscalculation