diff --git a/src/stream_gribapi.c b/src/stream_gribapi.c
index cd4d9f2725beeabaad5836e4f80b25f59230778c..bc464c2eb2d132cf540d059dc4312f1f479e0a1c 100644
--- a/src/stream_gribapi.c
+++ b/src/stream_gribapi.c
@@ -671,7 +671,7 @@ void grib2GetLevel(grib_handle *gh, int *leveltype, int *lbounds, int *level1, i
       status = grib_get_long(gh, "typeOfSecondFixedSurface", &lpar);
       if ( status == 0 ) leveltype2 = lpar;
 
-      if ( *leveltype == leveltype2 && leveltype != 255 ) *lbounds = 1;
+      if ( *leveltype == leveltype2 && *leveltype != 255 ) *lbounds = 1;
 
       if ( *lbounds == 0 )
 	{