diff --git a/FWCore/src/PodioDataSvc.cpp b/FWCore/src/PodioDataSvc.cpp
index 77da2e3644cca8be8d3d208ba78c665baef828fc..ce7d3699d5b7cd7e09d59be617ab73222803ad6c 100644
--- a/FWCore/src/PodioDataSvc.cpp
+++ b/FWCore/src/PodioDataSvc.cpp
@@ -67,7 +67,7 @@ void PodioDataSvc::endOfRead() {
   if (m_eventMax != -1) {
     m_provider.clearCaches();
     m_reader.endOfEvent();
-    if (m_eventNum++ > m_eventMax) {
+    if ( ++m_eventNum >= m_eventMax ) {
       info() << "Reached end of file with event " << m_eventMax << endmsg;
       IEventProcessor* eventProcessor;
       service("ApplicationMgr", eventProcessor);
diff --git a/FWCore/src/components/LCIODataSvc.cpp b/FWCore/src/components/LCIODataSvc.cpp
index b5ed5235cd29424451d5d4514fcf83cb9df13fa2..f31e13615870afd7e2a815e732de0fc21809f341 100644
--- a/FWCore/src/components/LCIODataSvc.cpp
+++ b/FWCore/src/components/LCIODataSvc.cpp
@@ -74,7 +74,7 @@ void LCIODataSvc::endOfRead() {
   if (m_eventMax != -1) {
     // m_provider.clearCaches();
     // m_reader.endOfEvent();
-    if (m_eventNum++ > m_eventMax) {
+    if ( ++m_eventNum >= m_eventMax ) {
       info() << "Reached end of file with event " << m_eventMax << endmsg;
       IEventProcessor* eventProcessor;
       service("ApplicationMgr", eventProcessor);