update topk to a more optimal version