diff --git a/src/pulse_detect.c b/src/pulse_detect.c
index 13b2338c..a104212b 100644
--- a/src/pulse_detect.c
+++ b/src/pulse_detect.c
@@ -287,8 +287,11 @@ int pulse_detect_package(pulse_detect_t *pulse_detect, int16_t const *envelope_d
 	pulse_detect_t *s = pulse_detect;
 	s->ook_high_estimate = max(s->ook_high_estimate, OOK_MIN_HIGH_LEVEL);	// Be sure to set initial minimum level
 
-	pulses->start_ago += len;
-	fsk_pulses->start_ago += len;
+	if (s->data_counter == 0) {
+		// age the pulse_data if this is a fresh buffer
+		pulses->start_ago += len;
+		fsk_pulses->start_ago += len;
+	}
 
 	// Process all new samples
 	while(s->data_counter < len) {
diff --git a/src/rtl_433.c b/src/rtl_433.c
index 052cf6e4..8930c1eb 100644
--- a/src/rtl_433.c
+++ b/src/rtl_433.c
@@ -1646,13 +1646,14 @@ int main(int argc, char **argv) {
                     n_read = fread(test_mode_buf, 1, DEFAULT_BUF_LENGTH, in_file);
                 }
                 if (n_read == 0) break;  // sdr_callback() will Segmentation Fault with len=0
-                n_blocks++;
-                demod->sample_file_pos = (float)n_blocks * n_read / cfg.samp_rate / 2 / demod->sample_size;
+                demod->sample_file_pos = ((float)n_blocks * DEFAULT_BUF_LENGTH + n_read) / cfg.samp_rate / 2 / demod->sample_size;
+                n_blocks++; // this assumes n_read == DEFAULT_BUF_LENGTH
                 sdr_callback(test_mode_buf, n_read, demod);
             } while (n_read != 0 && !cfg.do_exit);
 
             // Call a last time with cleared samples to ensure EOP detection
             memset(test_mode_buf, 128, DEFAULT_BUF_LENGTH);  // 128 is 0 in unsigned data
+            demod->sample_file_pos = ((float)n_blocks + 1) * DEFAULT_BUF_LENGTH / cfg.samp_rate / 2 / demod->sample_size;
             sdr_callback(test_mode_buf, DEFAULT_BUF_LENGTH, demod);
 
             //Always classify a signal at the end of the file