Fix frequency error calculation to get intended sign.