fixed a few bugs with creating valid redif files