Defined value of num_values before writing to file, was undefined