Fixed bad index when making joint histogram.