Bugs fixes moving fileio code.