Update scripts for data to datafile variable

Found an unexpected error in the code that must have been due to having
existing environment containing versions of the functions.