Fixed bug with reading/writing input file.