HISTOGRAM: more error checking