maybe throw an exception here if cacheTotalFreqs is false?