fixing the bug in histograms