diff --git a/src/BayesWaveMCMC.c b/src/BayesWaveMCMC.c
index 86bcacfd93090317ebb0e01f53dfd5068053152c..0baba9cd666ceac91f5a8002a920f85ad2c798c4 100644
--- a/src/BayesWaveMCMC.c
+++ b/src/BayesWaveMCMC.c
@@ -698,6 +698,14 @@ static void save_sampler(struct Data *data, struct Chain *chain, struct Model **
 
   FILE *fptr = NULL;
 
+  /****************************************************/
+  /*                                                  */
+  /* FLUSH CHAIN FILES                                */
+  /*                                                  */
+  /****************************************************/
+  flush_chain_files(data,chain,0);
+
+
   /****************************************************/
   /*                                                  */
   /* STATE VECTOR                                     */
@@ -1143,7 +1151,8 @@ void RJMCMC(struct Data *data, struct Model **model, struct BayesLineParams ***b
 
     //After so many iterations recompute the residuals and likelihood (prevent accumulation of roundoff error)
     recompute_residual(data, model, chain);
-    if(burnFlag==0 && chain->mc%1000==0 && data->signalFlag) TFprop_signal(data, prior->range, tf, model[chain->index[0]]->projection);
+    if(burnFlag==0 && data->signalFlag)
+      TFprop_signal(data, prior->range, tf, model[chain->index[0]]->projection);
 
     //Parallel tempering
     if(NC>1 && chain->mc>1)
diff --git a/src/BayesWaveProposal.c b/src/BayesWaveProposal.c
index d45dacb2d6cf297f09e8c33fa7e190652e26768a..2c83f7282ed07a05901ee8fcf323f8dc621ac5e3 100644
--- a/src/BayesWaveProposal.c
+++ b/src/BayesWaveProposal.c
@@ -1136,7 +1136,7 @@ void TFprop_setup(struct Data *data, struct Model *model, double **range, struct
         for(n=0; n<nbin; n++)
         {
           ii = nbin*i + ioff + n;
-          tsnr += (AC[ii]*AC[ii]+AF[ii]*AF[ii])/(fsnr);
+          if(ii>=0 && ii<tf->N) tsnr += (AC[ii]*AC[ii]+AF[ii]*AF[ii])/(fsnr);
         }
         tfsnr[m][j][i] = tsnr;
 
@@ -1340,7 +1340,7 @@ void TFprop_signal(struct Data *data, double **range, struct TimeFrequencyMap *t
                 for(i = 0; i < nt; i++)
                 {
                     ii = i - ioff;
-                    if(ii < 0 || ii > nt)
+                    if(ii < 0 || ii >= nt)
                     {
                         tsnr = tfsnr[0][m][j][i];  // leave out second detector if mapped out of time window (small edge effect)
                     }