Bug fixes for histogram.