diff --git a/src/language/utils/PugsFunctionAdapter.hpp b/src/language/utils/PugsFunctionAdapter.hpp
index 9b57a908e6341291d14e5e8f9c80aa8a87275dcc..7fef84f2d7bd0b8934c3e6e41583de3b540666b2 100644
--- a/src/language/utils/PugsFunctionAdapter.hpp
+++ b/src/language/utils/PugsFunctionAdapter.hpp
@@ -236,8 +236,8 @@ class PugsFunctionAdapter<OutputType(InputType...)>
           AggregateDataVariant& v = std::get<AggregateDataVariant>(result);
           OutputType x;
 
-          for (size_t i = 0, l = 0; i < x.dimension(); ++i) {
-            for (size_t j = 0; j < x.dimension(); ++j, ++l) {
+          for (size_t i = 0, l = 0; i < x.nbRows(); ++i) {
+            for (size_t j = 0; j < x.nbColumns(); ++j, ++l) {
               std::visit(
                 [&](auto&& Aij) {
                   using Aij_T = std::decay_t<decltype(Aij)>;