crucial correction when testing maxVar, must be < not <= in case maxVar==1.e20 (else adds nodata values)