fixed a logical error in frequency change