build a freq histogram properly