Fixing histogram bug