diff --git a/Reconstruction/RecGenfitAlg/CMakeLists.txt b/Reconstruction/RecGenfitAlg/CMakeLists.txt
index c3ea93008845010c7e10d4c6a17d9b5153be4846..758bdef08a6a8468731996e1c3696c30f913f5fe 100644
--- a/Reconstruction/RecGenfitAlg/CMakeLists.txt
+++ b/Reconstruction/RecGenfitAlg/CMakeLists.txt
@@ -18,13 +18,12 @@ gaudi_add_module(RecGenfitAlg
              DataHelperLib
              EDM4HEP::edm4hep
              EDM4HEP::edm4hepDict
-             $ENV{GenFit}/lib64/libgenfit2.so
+             GenFit::genfit2
 )
 
 target_include_directories(RecGenfitAlg PUBLIC
         $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>/include
         $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
-        $<BUILD_INTERFACE:$ENV{GenFit}>/include
 )
 
 install(TARGETS RecGenfitAlg
diff --git a/Reconstruction/RecGenfitAlg/src/GenfitField.cpp b/Reconstruction/RecGenfitAlg/src/GenfitField.cpp
index de6df54222b37684face8a615ea82dad76879f84..341e52f3d9c1a0e6539b62bec6225410dbbad7d4 100644
--- a/Reconstruction/RecGenfitAlg/src/GenfitField.cpp
+++ b/Reconstruction/RecGenfitAlg/src/GenfitField.cpp
@@ -43,7 +43,6 @@ GenfitField::get(const double& posX, const double& posY, const double& posZ,
             dd4hep::Position(posX/dd4hep::cm,posY/dd4hep::cm,posZ/dd4hep::cm));
     //m_dd4hepField.magneticField(pos,B);
 
-    double factor = 1./dd4hep::kilogauss;
     Bx=field.X()/dd4hep::kilogauss;
     By=field.Y()/dd4hep::kilogauss;
     Bz=field.Z()/dd4hep::kilogauss;