Fix frequency generation bug