diff --git a/external/NicaFemto.patch b/external/NicaFemto.patch
index 52e1a9ca674d23f3d822eb4554ec54a1e7adfeaf..0cb504c1b3657538e029c86e8a912b369158bc05 100644
--- a/external/NicaFemto.patch
+++ b/external/NicaFemto.patch
@@ -50,3 +50,15 @@ index b8576ab..b3fc335 100644
  
  GENERATE_LIBRARY()
  
+diff --git a/features/NicaHelixBase.cxx b/features/NicaHelixBase.cxx
+index e248f54..7317950 100644
+--- a/features/NicaHelixBase.cxx
++++ b/features/NicaHelixBase.cxx
+@@ -8,6 +8,7 @@
+  */
+ #include "NicaHelixBase.h"
+ #include <TMath.h>
++#include <TString.h>
+ #include <iostream>
+
+ Double_t NicaHelixBase::fgHelixBz = 0.5;
diff --git a/reco/L1/L1Algo/utils/L1AlgoDraw.cxx b/reco/L1/L1Algo/utils/L1AlgoDraw.cxx
index 40fa018e2d90cb80e0424c4ca912ed447868b9af..0bd92cc6366fe5e6fb2698bdb4f5fd30658caac3 100644
--- a/reco/L1/L1Algo/utils/L1AlgoDraw.cxx
+++ b/reco/L1/L1Algo/utils/L1AlgoDraw.cxx
@@ -12,6 +12,7 @@
 #include "TEllipse.h"
 #include "TFrame.h"
 #include "TLatex.h"
+#include "TLine.h"
 #include "TMarker.h"
 #include "TPad.h"
 #include "TPaveText.h"
diff --git a/reco/detectors/trd/qa/CbmTrdHitDensityQa.cxx b/reco/detectors/trd/qa/CbmTrdHitDensityQa.cxx
index b7235b61c5b955f5ecaa913ec9f85f50060bbb98..6a10ce15d63dd432189c4e9b7b9210b72515b2ed 100644
--- a/reco/detectors/trd/qa/CbmTrdHitDensityQa.cxx
+++ b/reco/detectors/trd/qa/CbmTrdHitDensityQa.cxx
@@ -412,7 +412,6 @@ void CbmTrdHitDensityQa::Finish()
   }
   else
     tempFile = new TFile(newpath, "recreate");
-  gDirectory = tempFile->CurrentDirectory();
   gDirectory->pwd();
 
   if (fPlotResults) fEventCounter = (TH1I*) tempFile->Get("fEventCounter");
diff --git a/reco/detectors/trd/qa/CbmTrdOccupancyQa.cxx b/reco/detectors/trd/qa/CbmTrdOccupancyQa.cxx
index f1ad48baa46ced1243effe6c5d76bc90d0da1962..5f887f33cbe1da2076f11ca22cc56d716f85f986 100644
--- a/reco/detectors/trd/qa/CbmTrdOccupancyQa.cxx
+++ b/reco/detectors/trd/qa/CbmTrdOccupancyQa.cxx
@@ -405,7 +405,6 @@ void CbmTrdOccupancyQa::SwitchToMergedFile()
   TString filename = "data/result.root";
   TFile* Target    = new TFile(filename, "READ");
   if (Target) {
-    gDirectory = Target->CurrentDirectory();
     for (fModuleOccupancyMapIt = fModuleOccupancyMap.begin(); fModuleOccupancyMapIt != fModuleOccupancyMap.end();
          ++fModuleOccupancyMapIt) {
       TString histName = fModuleOccupancyMapIt->second->GetName();
@@ -437,7 +436,6 @@ void CbmTrdOccupancyQa::CreateLayerView()
   newpath.ReplaceAll(":/", "");
 
   TFile* tempFile = new TFile(newpath, "recreate");
-  gDirectory      = tempFile->CurrentDirectory();
   gDirectory->pwd();
   cout << "CreateLayerView" << endl;
   Bool_t debug = false;
@@ -641,7 +639,6 @@ void CbmTrdOccupancyQa::SaveHistos2File()
   newpath.ReplaceAll(":/", "");
 
   TFile* tempFile = new TFile(newpath, "Update");
-  gDirectory      = tempFile->CurrentDirectory();
   gDirectory->pwd();
 
   cout << "SaveHistos2File" << endl;
diff --git a/reco/detectors/trd/qa/CbmTrdQa.cxx b/reco/detectors/trd/qa/CbmTrdQa.cxx
index 4825d5134216a64b3f07521576f0d3239534d82a..45059a7c00c2d36626d5a5a45bed06ba92fd7ba8 100644
--- a/reco/detectors/trd/qa/CbmTrdQa.cxx
+++ b/reco/detectors/trd/qa/CbmTrdQa.cxx
@@ -1376,7 +1376,6 @@ void CbmTrdQa::SaveHistos()
   newpath.ReplaceAll("eds", "trd_qa");
   newpath.ReplaceAll(":/", "");
   TFile* tempFile = new TFile(newpath, "recreate");
-  gDirectory      = tempFile->CurrentDirectory();
   gDirectory->pwd();
 
   TString title;
@@ -1723,7 +1722,6 @@ void CbmTrdQa::CreateLayerView(std::map<Int_t, TH1*>& Map, TString folder, TStri
   newpath.ReplaceAll("eds", "trd_qa");
   newpath.ReplaceAll(":/", "");
   TFile* tempFile = new TFile(newpath, "recreate");
-  gDirectory      = tempFile->CurrentDirectory();
   gDirectory->pwd();
   TString title(""), name("");
   name.Form("_TH_%.2EGeV_", fTriggerThreshold);
@@ -1809,7 +1807,6 @@ void CbmTrdQa::CreateLayerView()
   newpath.ReplaceAll("eds", "trd_qa");
   newpath.ReplaceAll(":/", "");
   TFile* tempFile = new TFile(newpath, "recreate");
-  gDirectory      = tempFile->CurrentDirectory();
   gDirectory->pwd();
   TString title(""), name("");
   TPaveText* text = NULL;
diff --git a/sim/transport/generators/pluto/PParticle.h b/sim/transport/generators/pluto/PParticle.h
index 9a5fe77ea66ce183b23bc2d34a8cc826af7ab4c2..953a984cb84e27e282902faf552826a09d451c9e 100644
--- a/sim/transport/generators/pluto/PParticle.h
+++ b/sim/transport/generators/pluto/PParticle.h
@@ -21,6 +21,7 @@
 
 #include "TLorentzVector.h"
 #include "TMath.h"
+#include "TString.h"
 
 #include "PValues.h"
 
diff --git a/sim/transport/generators/unigen/UEvent.h b/sim/transport/generators/unigen/UEvent.h
index ad8abc8c71e913bd0304c2d46d35d62b7d55e387..a146bc52c6d197cf455817c0a40dbf995d006ccc 100644
--- a/sim/transport/generators/unigen/UEvent.h
+++ b/sim/transport/generators/unigen/UEvent.h
@@ -7,6 +7,7 @@
 
 #include "TLorentzVector.h"
 #include "TObject.h"
+#include "TString.h"
 
 class UParticle;