Keep the Histogram calculation from going into an infinite loop