fix bug in frequency table