Fixes to histogram statistics