diff --git a/dumux/material/fluidsystems/h2on2fluidsystem.hh b/dumux/material/fluidsystems/h2on2fluidsystem.hh
index 529b92e854173cbd0b4a2c3eac1323bb9f20f9e3..daedcbb77a69388455809736cd33980206be5e8b 100644
--- a/dumux/material/fluidsystems/h2on2fluidsystem.hh
+++ b/dumux/material/fluidsystems/h2on2fluidsystem.hh
@@ -381,7 +381,7 @@ public:
         // other
         Scalar rho_gH2O = H2O::gasDensity(T, p*fluidState.moleFraction(gPhaseIdx, H2OIdx));
         Scalar rho_gN2 = N2::gasDensity(T, p*fluidState.moleFraction(gPhaseIdx, N2Idx));
-        return rho_gH2O + rho_gN2;
+        return (rho_gH2O + rho_gN2) / std::max(1e-5, sumMoleFrac);
     };
 
     /*!