new algorithm for calculating bin number on histograms, not working,
probably have another bug in displaying histograms