modifies save_freq code