diff --git a/Source/Plugins/SpikeSorter/SpikeSortBoxes.cpp b/Source/Plugins/SpikeSorter/SpikeSortBoxes.cpp
index a3906b691ad8cb80c8ea28a11527b1d37b5641ef..07fa1baa789510ac08c5b72f4cc5e01e650f3a3e 100644
--- a/Source/Plugins/SpikeSorter/SpikeSortBoxes.cpp
+++ b/Source/Plugins/SpikeSorter/SpikeSortBoxes.cpp
@@ -884,7 +884,7 @@ void SpikeSortBoxes::projectOnPrincipalComponents(SorterSpikePtr so)
             bPCAJobSubmitted = true;
             bRePCA = false;
             // submit a new job to compute the spike buffer.
-            PCAJobPtr job = new PCAjob(spikeBuffer,pc1,pc2, &pc1min, &pc2min, &pc1max, &pc2max, bPCAjobFinished);
+            PCAJobPtr job = new PCAjob(spikeBuffer,pc1,pc2, pc1min, pc2min, pc1max, pc2max, bPCAjobFinished);
             computingThread->addPCAjob(job);
         }
     }
@@ -1706,15 +1706,13 @@ static double sqrarg;
 #define SQR(a) ((sqrarg = (a)) == 0.0 ? 0.0 : sqrarg * sqrarg)
 
 PCAjob::PCAjob(SorterSpikeArray& _spikes, float* _pc1, float* _pc2,
-               float* pc1Min, float* pc2Min, float* pc1Max, float* pc2Max, std::atomic<bool>& _reportDone) : spikes(_spikes), reportDone(_reportDone)
+                std::atomic<float>& pc1Min,  std::atomic<float>& pc2Min,  std::atomic<float>&pc1Max,  std::atomic<float>& pc2Max, std::atomic<bool>& _reportDone) : spikes(_spikes),
+pc1min(pc1Min), pc2min(pc2Min), pc1max(pc1Max), pc2max(pc2Max), reportDone(_reportDone)
 {
     cov = nullptr;
     pc1 = _pc1;
     pc2 = _pc2;
-    pc1min = pc1Min;
-    pc2min = pc2Min;
-    pc1max = pc1Max;
-    pc2max = pc2Max;
+
     dim = spikes[0]->getChannel()->getNumChannels()*spikes[0]->getChannel()->getTotalSamples();
 
 };
@@ -2114,10 +2112,10 @@ void PCAjob::computeSVD()
     }
 
 
-    *pc1min = min1 - 1.5 * (max1-min1);
-    *pc2min = min2 - 1.5 * (max2-min2);
-    *pc1max = max1 + 1.5 * (max1-min1);
-    *pc2max = max2 + 1.5 * (max2-min2);
+    pc1min = min1 - 1.5 * (max1-min1);
+    pc2min = min2 - 1.5 * (max2-min2);
+    pc1max = max1 + 1.5 * (max1-min1);
+    pc2max = max2 + 1.5 * (max2-min2);
 
     // clear memory
     for (int k = 0; k < dim; k++)
diff --git a/Source/Plugins/SpikeSorter/SpikeSortBoxes.h b/Source/Plugins/SpikeSorter/SpikeSortBoxes.h
index 35a1786f4db28887ed9133ea20fbc2ae92b8c2d1..a43917c3fb4ac09aaf0db7f78e8a7bb92f8390da 100644
--- a/Source/Plugins/SpikeSorter/SpikeSortBoxes.h
+++ b/Source/Plugins/SpikeSorter/SpikeSortBoxes.h
@@ -181,7 +181,7 @@ class PCAjob : public ReferenceCountedObject
 {
 public:
     PCAjob(SorterSpikeArray& _spikes, float* _pc1, float* _pc2,
-           float*, float*, float*, float*, std::atomic<bool>& _reportDone);
+           std::atomic<float>&,  std::atomic<float>&,  std::atomic<float>&,  std::atomic<float>&, std::atomic<bool>& _reportDone);
     ~PCAjob();
     void computeCov();
     void computeSVD();
@@ -189,7 +189,7 @@ public:
     float** cov;
     SorterSpikeArray spikes;
     float* pc1, *pc2;
-    float* pc1min, *pc2min, *pc1max, *pc2max;
+    std::atomic<float>& pc1min, &pc2min, &pc1max, &pc2max;
     std::atomic<bool>& reportDone;
 private:
     int svdcmp(float** a, int nRows, int nCols, float* w, float** v);
@@ -302,7 +302,7 @@ private:
     std::vector<BoxUnit> boxUnits;
     std::vector<PCAUnit> pcaUnits;
     float* pc1, *pc2;
-    float pc1min, pc2min, pc1max, pc2max;
+    std::atomic<float> pc1min, pc2min, pc1max, pc2max;
     SorterSpikeArray spikeBuffer;
     int bufferSize,spikeBufferIndex;
     PCAcomputingThread* computingThread;