Fix to bug whereby using the export truncates the original data file! Oops.