diff --git a/reco/detectors/mvd/plugins/tasks/CbmMvdSensorFindHitTask.cxx b/reco/detectors/mvd/plugins/tasks/CbmMvdSensorFindHitTask.cxx
index 7fc5b0394e502ef4c74e4064f67e3a6b12ce1959..1ef479a4532d61804c31274c8ccb9615505e23e5 100644
--- a/reco/detectors/mvd/plugins/tasks/CbmMvdSensorFindHitTask.cxx
+++ b/reco/detectors/mvd/plugins/tasks/CbmMvdSensorFindHitTask.cxx
@@ -556,10 +556,8 @@ void CbmMvdSensorFindHitTask::CreateHit(vector<Int_t>* clusterArray, TVector3& p
 
 
   Int_t indexX, indexY;
-  //Double_t x,y;
-  Double_t local[2];
-  local[0] = pos.X();
-  local[1] = pos.Y();
+  Double_t local[3] = {pos.X(), pos.Y(), pos.Z()};
+
   //LOG(debug) << "found center of gravity at: " << local[0] << " , " << local[1];
 
   fSensor->TopToPixel(local, indexX, indexY);
diff --git a/reco/detectors/mvd/plugins/tasks/CbmMvdSensorHitfinderTask.cxx b/reco/detectors/mvd/plugins/tasks/CbmMvdSensorHitfinderTask.cxx
index 3c4a4365caf79bae0521e6663ad44f4bb0f74042..22268461f02e9fb0a3369df23757c6119b079463 100644
--- a/reco/detectors/mvd/plugins/tasks/CbmMvdSensorHitfinderTask.cxx
+++ b/reco/detectors/mvd/plugins/tasks/CbmMvdSensorHitfinderTask.cxx
@@ -257,10 +257,8 @@ void CbmMvdSensorHitfinderTask::CreateHit(CbmMvdCluster* cluster, TVector3& pos,
 
 
   Int_t indexX, indexY;
-  //Double_t x,y;
-  Double_t local[2];
-  local[0] = pos.X();
-  local[1] = pos.Y();
+  Double_t local[3] = {pos.X(), pos.Y(), pos.Z()};
+
   //LOG(debug)<< "found center of gravity at: " << local[0] << " , " << local[1];
 
   fSensor->TopToPixel(local, indexX, indexY);