diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,11 @@
 
+Version 5.4
+-----
+
+* A more correct treating of the stop time. Earlier, the final
+  integration time point was used instead of the stop time in
+  some functions.
+
 Version 5.3.1
 -----
 
diff --git a/Simulation/Aivika/Internal/Dynamics.hs b/Simulation/Aivika/Internal/Dynamics.hs
--- a/Simulation/Aivika/Internal/Dynamics.hs
+++ b/Simulation/Aivika/Internal/Dynamics.hs
@@ -74,7 +74,7 @@
 -- | Run the 'Dynamics' computation in the final time point.
 runDynamicsInStopTime :: Dynamics a -> Simulation a
 runDynamicsInStopTime (Dynamics m) =
-  Simulation $ m . integStopPoint
+  Simulation $ m . simulationStopPoint
 
 -- | Run the 'Dynamics' computation in all integration time points.
 runDynamicsInIntegTimes :: Dynamics a -> Simulation [IO a]
diff --git a/Simulation/Aivika/Internal/Event.hs b/Simulation/Aivika/Internal/Event.hs
--- a/Simulation/Aivika/Internal/Event.hs
+++ b/Simulation/Aivika/Internal/Event.hs
@@ -334,7 +334,7 @@
 enqueueEventWithStopTime :: Event () -> Event ()
 enqueueEventWithStopTime e =
   Event $ \p ->
-  let p0 = integStopPoint $ pointRun p
+  let p0 = simulationStopPoint $ pointRun p
   in invokeEvent p $ enqueueEventWithPoints [p0] e
 
 -- | It allows cancelling the event.
diff --git a/Simulation/Aivika/Internal/Specs.hs b/Simulation/Aivika/Internal/Specs.hs
--- a/Simulation/Aivika/Internal/Specs.hs
+++ b/Simulation/Aivika/Internal/Specs.hs
@@ -27,6 +27,7 @@
         integPointsStartingFrom,
         integStartPoint,
         integStopPoint,
+        simulationStopPoint,
         timeGrid,
         pointAt) where
 
@@ -200,7 +201,7 @@
                            pointIteration = n,
                            pointPhase = 0 }
 
--- | Return the stop time point.
+-- | Return the integration stop time point.
 integStopPoint :: Run -> Point
 integStopPoint r = point nu
   where sc = runSpecs r
@@ -210,6 +211,10 @@
                            pointTime = basicTime sc n 0,
                            pointIteration = n,
                            pointPhase = 0 }
+
+-- | Return the simulation stop time point.
+simulationStopPoint :: Run -> Point
+simulationStopPoint r = pointAt r (spcStopTime $ runSpecs r)
 
 -- | Return the point at the specified time.
 pointAt :: Run -> Double -> Point
diff --git a/aivika.cabal b/aivika.cabal
--- a/aivika.cabal
+++ b/aivika.cabal
@@ -1,5 +1,5 @@
 name:            aivika
-version:         5.3.1
+version:         5.4
 synopsis:        A multi-method simulation library
 description:
     Aivika is a discrete event simulation (DES) framework with support of activity-oriented,
