Fixing potential issues with histogram binning