diff --git a/include/scalfmm/tools/fma_loader.hpp b/include/scalfmm/tools/fma_loader.hpp
index 0cd0ba123b0945836ced7868f889b00ec024266b..136c937301b5b4b2d2e258cdec1f79b21a23ae42 100644
--- a/include/scalfmm/tools/fma_loader.hpp
+++ b/include/scalfmm/tools/fma_loader.hpp
@@ -682,6 +682,8 @@ namespace scalfmm::io
          * Should be used if we write the particles with writeArrayOfReal method
          *
          * @tparam PointType  The type of a point
+         * @tparam IntType1   The type of a nbParticles
+         * @tparam IntType1  The type of a theother integer variables
          * @param centerOfBox      The center of the Box (FPoint<FReal, dimension> class)
          * @param boxWidth         The width of the box
          * @param nbParticles      Number of particles in the box (or to save)
@@ -690,10 +692,10 @@ namespace scalfmm::io
          * @param dimension.       The dimension of the problem 
          * @param nb_input_values. The number of input values in a particle
          */
-        template<class PointType, typename IntType>
-        auto writeHeader(const PointType& centerOfBox, const FReal& boxWidth, const IntType& nbParticles,
-                         const IntType& dataType, const IntType& nbDataPerRecord, const IntType& dimension,
-                         const IntType& nb_input_values) -> void
+        template<class PointType, typename IntType1, typename IntType2>
+        auto writeHeader(const PointType& centerOfBox, const FReal& boxWidth, const IntType1& nbParticles,
+                         const IntType2& dataType, const IntType2& nbDataPerRecord, const IntType2& dimension,
+                         const IntType2& nb_input_values) -> void
         {
             std::array<unsigned int, 4> typeFReal = {
               static_cast<unsigned int>(dataType), static_cast<unsigned int>(nbDataPerRecord),
@@ -723,11 +725,10 @@ namespace scalfmm::io
             }
             std::cout << std::endl << std::flush;
         }
-
-        template<typename IntType>
-        auto writeHeader(const FReal* centerOfBox, const FReal& boxWidth, const IntType& nbParticles,
-                         const IntType& dataType, const IntType& nbDataPerRecord, const IntType& dimension,
-                         const IntType& nb_input_values) -> void
+        template<typename IntType1, typename IntType2>
+        auto writeHeader(const FReal* centerOfBox, const FReal& boxWidth, const IntType1& nbParticles,
+                         const IntType2& dataType, const IntType2& nbDataPerRecord, const IntType2& dimension,
+                         const IntType2& nb_input_values) -> void
         {
             std::array<unsigned int, 4> typeFReal = {
               static_cast<unsigned int>(dataType), static_cast<unsigned int>(nbDataPerRecord),
@@ -895,8 +896,8 @@ namespace scalfmm::io
             //
             // write the particles
             const auto& centre = tree.box_center();
-            this->writeHeader(centre, tree.box_width(), number_particles, sizeof(value_type), nb_elt_per_par,
-                              centre.dimension, nb_input_elements);
+            this->writeHeader(centre, tree.box_width(), number_particles, static_cast<std::size_t>(sizeof(value_type)),
+                              nb_elt_per_par, centre.dimension, nb_input_elements);
             this->writeArrayOfReal(particles.data()->data(), nb_elt_per_par, number_particles);
         }
 
@@ -921,9 +922,11 @@ namespace scalfmm::io
         {
             // get the number of elements per particles in the container build with tuples.
             using particle_type = typename ContainerType::value_type;
-            constexpr int nb_elt_per_par = meta::tuple_size_v<particle_type>;
+            constexpr std::size_t nb_elt_per_par = meta::tuple_size_v<particle_type>;
+            static constexpr std::size_t dimension = particle_type::dimension_size;
+
             // Not good output_values are put in input_values
-            constexpr int nb_input_per_par = particle_type::inputs_size;
+            constexpr std::size_t nb_input_per_par = particle_type::inputs_size;
             ///  @todo check for different input and output types (double versus complexe)
             using data_type = typename particle_type::outputs_value_type;
             //
@@ -943,8 +946,8 @@ namespace scalfmm::io
             };
             //  write the particles
             // Here we need to separate input from output variables - no tools yet
-            this->writeHeader(center, box_width, number_particles, sizeof(data_type), nb_elt_per_par, center.dimension,
-                              nb_input_per_par);
+            this->writeHeader(center, box_width, number_particles, static_cast<std::size_t>(sizeof(data_type)),
+                              nb_elt_per_par, dimension, nb_input_per_par);
             this->writeArrayOfReal(particles.data()->data(), nb_elt_per_par, number_particles);
         }
 
diff --git a/tools/generate_distribution.cpp b/tools/generate_distribution.cpp
index cf435a53c86749821d39a82a693a676b6a24b167..b7b8e385a860bf3cf6458d32b50ce7071e0c4719 100644
--- a/tools/generate_distribution.cpp
+++ b/tools/generate_distribution.cpp
@@ -538,15 +538,15 @@ auto main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[]) -> int
     if(use_double)
     {
         scalfmm::io::FFmaGenericWriter<value_type> writer(output_file);
-        writer.writeHeader(boxCenter, boxWith, nb_particles, sizeof(value_type), n_data_per_particle, dimension,
-                           number_input_values);
+        writer.writeHeader(boxCenter, boxWith, nb_particles, static_cast<int>(sizeof(value_type)), n_data_per_particle,
+                           dimension, number_input_values);
         writer.writeArrayOfReal(data.data(), n_data_per_particle, nb_particles);
     }
     else
     {
         scalfmm::io::FFmaGenericWriter<float> writer(output_file);
-        writer.writeHeader(boxCenter, boxWith, nb_particles, sizeof(float), n_data_per_particle, dimension,
-                           number_input_values);
+        writer.writeHeader(boxCenter, boxWith, nb_particles, static_cast<int>(sizeof(float)), n_data_per_particle,
+                           dimension, number_input_values);
         std::vector<float> dataFloat(data.size());
         std::copy(data.begin(), data.end(), dataFloat.begin());
         writer.writeArrayOfReal(dataFloat.data(), n_data_per_particle, nb_particles);
diff --git a/tools/sort_particles.cpp b/tools/sort_particles.cpp
index f9487b3c4758cde46d93d93711cdac948a18a99a..ac8cf389ffb8e812cb72c4a3b5ca070e00f4c593 100644
--- a/tools/sort_particles.cpp
+++ b/tools/sort_particles.cpp
@@ -90,7 +90,7 @@ namespace loc_args
     };
 }   // namespace loc_args
 
-template<int Dimension, typename value_type>
+template<unsigned int Dimension, typename value_type>
 auto run(const std::string& input_file, const std::string& output_file, const bool verbose) -> int
 
 {
@@ -99,7 +99,7 @@ auto run(const std::string& input_file, const std::string& output_file, const bo
 
     scalfmm::io::FFmaGenericLoader<value_type, Dimension> loader(input_file, verbose);
     //
-    auto nb_particles = loader.getNumberOfParticles();
+    std::size_t nb_particles = loader.getNumberOfParticles();
     const unsigned int n_data_per_particle = loader.getNbRecordPerline();
 
     if(Dimension != loader.get_dimension())
@@ -127,8 +127,9 @@ auto run(const std::string& input_file, const std::string& output_file, const bo
     // }
 
     scalfmm::io::FFmaGenericWriter<value_type> writer(output_file);
-    writer.writeHeader(loader.getCenterOfBox(), loader.getBoxWidth(), nb_particles, sizeof(value_type),
-                       n_data_per_particle, Dimension, loader.get_number_of_input_per_record());
+    writer.writeHeader(loader.getCenterOfBox(), loader.getBoxWidth(), nb_particles,
+                       static_cast<unsigned int>(sizeof(value_type)), n_data_per_particle, Dimension,
+                       loader.get_number_of_input_per_record());
 
     writer.writeArrayOfReal(particles1.data(), n_data_per_particle, nb_particles);
     std::cout << "End of writing" << std::endl;