diff --git a/include/scalfmm/utils/sort.hpp b/include/scalfmm/utils/sort.hpp
index d563a0bfecb05aed6a240f07f13f57c8e5a2a5dc..0d9fba59206fb755939a136d8e8e9ef6643898f6 100644
--- a/include/scalfmm/utils/sort.hpp
+++ b/include/scalfmm/utils/sort.hpp
@@ -264,7 +264,7 @@ namespace scalfmm::utils
         std::copy(array.begin(), array.end(), tmp_array);
         constexpr static const std::size_t dimension = points_type::dimension;
         //
-        const std::size_t max_level = 2;   //sizeof(morton_type) * 8 / dimension - 1;
+        const std::size_t max_level = sizeof(morton_type) * 8 / dimension - 1;
         using pair_type = std::pair<morton_type, int>;
         std::vector<pair_type> tosort(nbParticles);
 #pragma omp parallel for shared(tosort, nbParticles, box, max_level, array)
@@ -275,7 +275,7 @@ namespace scalfmm::utils
             tosort[i].second = i;
         }
 
-        std::sort(tosort.begin(), tosort.end(), [&](pair_type& a, pair_type& b) { return (a.first > b.first); });
+        std::sort(tosort.begin(), tosort.end(), [&](pair_type& a, pair_type& b) { return (a.first < b.first); });
 
         //
         // We fill the sorted array