fixed error @ frequency calculation