fix data loss bug + histogram correctness tests

1) verify bin count is <= maxBins not ==
2) ensure that the number of points in all bins is the number of points recorded
3) avoid losing data when compressing bins in the middle of a slice