diff --git a/include/teqp/models/saftvrmie.hpp b/include/teqp/models/saftvrmie.hpp
index 029b2385e084b76f585fa359b3e873432def3708..f50d7b0a530cc9ae280b36be193ec74a2f13684b 100644
--- a/include/teqp/models/saftvrmie.hpp
+++ b/include/teqp/models/saftvrmie.hpp
@@ -784,7 +784,7 @@ public:
         auto fromArrayX = [](const Eigen::ArrayXd &x){std::valarray<double>n(x.size()); for (auto i =0; i < n.size(); ++i){ n[i] = x[i];} return n;};
         auto fromArrayXX = [](const Eigen::ArrayXXd &x){
             std::size_t N = x.rows();
-            std::vector<std::vector<double>> n; n.resize(x.size());
+            std::vector<std::vector<double>> n; n.resize(N);
             for (auto i = 0; i < N; ++i){
                 n[i].resize(N);
                 for (auto j = 0; j < N; ++j){
diff --git a/src/tests/catch_test_SAFTVRMie.cxx b/src/tests/catch_test_SAFTVRMie.cxx
index 65a154f300e8c4fe2963604afb2bd62f10853704..d03cbc60469147061a54c9bc28ef955c49c2edd8 100644
--- a/src/tests/catch_test_SAFTVRMie.cxx
+++ b/src/tests/catch_test_SAFTVRMie.cxx
@@ -326,6 +326,22 @@ TEST_CASE("Check B and its temperature derivatives", "[SAFTVRMie],[B]")
     CHECK(TdBdT == Approx(TdBdTnondilute));
 }
 
+TEST_CASE("Check output of dmat", "[SAFTVRMiedmat]")
+{
+    auto j = nlohmann::json::parse(R"({
+        "kind": "SAFT-VR-Mie",
+        "model": {
+            "names": ["Methane", "Ethane"]
+        }
+    })");
+    CHECK_NOTHROW(teqp::cppinterface::make_model(j));
+    auto ptr = teqp::cppinterface::make_model(j);
+    const auto& model = teqp::cppinterface::adapter::get_model_cref<SAFTVRMie_t>(ptr.get());
+    auto z = (Eigen::ArrayXd(2) << 0.300, 0.7).finished();
+    auto jj = model.get_core_calcs(300, 0.5, z);
+    std::cout << jj.dump(2) << std::endl;
+}
+
 TEST_CASE("Check ln(phi) and its derivatives", "[SAFTVRMielnphi]")
 {
     std::vector<std::string> names = {"Methane", "Ethane"};