added an extra check for maxFreq input