fixed some of the histogram bugs, not all i think