Trying to fix empty input file segfault/failure to put new data in output from data file