diff --git a/ChangeLog b/ChangeLog
index b1e9272c0692a43be5c759aa014b62854d57147e..8ba6f445028cdcfb2eb02ab1eff172c85210c69d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2025-03-14  Uwe Schulzweida
+
+	* enable-hirlam-extensions failed since release 2.5.1 (bug fix)
+
 2025-03-05  Uwe Schulzweida
 
 	* Version 2.5.1 released
diff --git a/src/grb_write.c b/src/grb_write.c
index 217904313fda17b3dfc7d6f1a7d3caf7ed14f976..7f699aac75d87694f237e30127a9845a49aa8727 100644
--- a/src/grb_write.c
+++ b/src/grb_write.c
@@ -316,8 +316,8 @@ grbCopyField(stream_t *streamptr2, stream_t *streamptr1)
           size_t numMissVals = 0;
 
           int vlistID = streamptr1->vlistID;
-          int varID = record->varID;
-          int levelID = record->levelID;
+          int varID = recinfo->varID;
+          int levelID = recinfo->levelID;
           int gridID = vlistInqVarGrid(vlistID, varID);
 
           size_t gridsize = gridInqSize(gridID);