fix cur_reg being overwritten