diff --git a/ChangeLog b/ChangeLog
index 4ba6c738ac8142af457348c19b19a9bd5bd4c104..17ce50d706b42e07b355132d28c3c1e50bd3ed0a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2025-03-25  Uwe Schulzweida
+
+	* Input: failed with more than one record (bug fix)
+
 2025-03-20  Uwe Schulzweida
 
 	* gme_grid: check if calculation of coordinates failed
diff --git a/libcdi b/libcdi
index 6729bee6d0a040c99d0f6aac7d768b1adb5a81ee..3b65d721f75aed9057376f2b271ebd129a49e909 160000
--- a/libcdi
+++ b/libcdi
@@ -1 +1 @@
-Subproject commit 6729bee6d0a040c99d0f6aac7d768b1adb5a81ee
+Subproject commit 3b65d721f75aed9057376f2b271ebd129a49e909
diff --git a/src/Input.cc b/src/Input.cc
index b4bd341471eecd02dd104dca253d6057d7542690..4eb40d6e5eac4eb5f9a0da89b4b2c24c6c399c2a 100644
--- a/src/Input.cc
+++ b/src/Input.cc
@@ -37,7 +37,7 @@ input_iarray(size_t numVals, int *array)
 }
 
 static int
-read_record(int numFields, int numLevels, size_t gridsize0, int &code, int &date, int &time, std::vector<double> &array)
+read_record(int numFields, int numLevels, size_t &gridsize0, int &code, int &date, int &time, std::vector<double> &array)
 {
   code = -1;
   date = 10101;
@@ -59,7 +59,7 @@ read_record(int numFields, int numLevels, size_t gridsize0, int &code, int &date
 }
 
 static int
-read_record_ext(int numFields, size_t gridsize0, int &code, int &date, int &time, std::vector<double> &array, int &gridID,
+read_record_ext(int numFields, size_t &gridsize0, int &code, int &date, int &time, std::vector<double> &array, int &gridID,
                 double &dlevel)
 {
   cdo_print("Enter header (date,code,level,gridsize) of record %d (or EOF(=^D))!", numFields + 1);
@@ -98,7 +98,7 @@ read_record_ext(int numFields, size_t gridsize0, int &code, int &date, int &time
 }
 
 static int
-read_record_srv(int numFields, size_t gridsize0, int &code, int &date, int &time, std::vector<double> &array, int &gridID,
+read_record_srv(int numFields, size_t &gridsize0, int &code, int &date, int &time, std::vector<double> &array, int &gridID,
                 double &dlevel)
 {
   cdo_print("Enter header (code,level,date,time,nlon,nlat,dispo1,dispo2) of record %d (or EOF(=^D))!", numFields + 1);
@@ -192,13 +192,11 @@ public:
     if (operatorID == INPUT) { outputFiletype = cdo_filetype(); }
     else if (operatorID == INPUTEXT)
       {
-        outputFiletype = CdoDefault::FileType;
-        if (outputFiletype == CDI_UNDEFID) outputFiletype = CDI_FILETYPE_EXT;
+        outputFiletype = (CdoDefault::FileType == CDI_UNDEFID) ? CDI_FILETYPE_EXT : CdoDefault::FileType;
       }
     else if (operatorID == INPUTSRV)
       {
-        outputFiletype = CdoDefault::FileType;
-        if (outputFiletype == CDI_UNDEFID) outputFiletype = CDI_FILETYPE_SRV;
+        outputFiletype = (CdoDefault::FileType == CDI_UNDEFID) ? CDI_FILETYPE_SRV : CdoDefault::FileType;
       }
   }