fixed histogram calculation