modify frequency calculation formula