Fixed epoch variable and record number sequence

Previous version had incorrect record number handling for various cadence data, this lead to a problem with the epoch variable being stored incorrectly in some files. Also, A problem was fixed with gaps in spectral data not being handled correctly, again caused by not keeping track of record numbers correctly.