diff --git a/.rake.json b/.rake.json
index 2bc23324928b7e862b7feaa41a24072582009957..a13d736c562d3310a9d802d33a9a4fdae7948d25 100644
--- a/.rake.json
+++ b/.rake.json
@@ -30,6 +30,15 @@
       "dir": "/users/ram/builds/cdo",
       "username": "ram",
       "CC": ["icc","pgcc","cray","gcc"]
+    },
+    "wanglung": {
+      "hostname": "wanglung.mpi.zmaw.de",
+      "dir": "/home/zmaw/m300064/builds/remote"
+    },
+    "ubuntu-32bit": {
+      "hostname": "cdo4windows-ubuntu.mpimet.mpg.de",
+      "dir": "/home/mpimet/build/cdo",
+      "username":"mpimet"
     }
   },
 
@@ -59,6 +68,44 @@
       "configureCall": "./configure --disable-openmp CC=gcc CFLAGS='-g -O2'",
       "makeCall": "make -j 12",
       "sync": true
+    },
+    "localGCC": {
+      "doc": "local builder with default GCC - VPATH build",
+      "hostname": "luthien",
+      "configureCall": "/home/ram/src/cdo/configure --enable-openmp CC=gcc CFLAGS='-g -O2'",
+      "makeCall": "make -j 12",
+      "sync": false
+    },
+    "macOSGCC": {
+      "hostname": "wanglung",
+      "configureCall": "./configure CC=gcc CFLAGS='-g -O2'",
+      "makeCall": "make -j 12",
+      "sync": true
+    },
+    "macOSCLANG": {
+      "hostname": "wanglung",
+      "configureCall": "./configure CC=clang CFLAGS='-g -O2'",
+      "makeCall": "make -j 12",
+      "sync": true
+    },
+    "macOSCLANG++": {
+      "hostname": "wanglung",
+      "configureCall": "./configure --enable-cxx CC=clang CXX=clang++ CFLAGS='-g -O2'",
+      "makeCall": "make -j 12",
+      "sync": true
+    },
+    "macOSG++": {
+      "hostname": "wanglung",
+      "configureCall": "./configure --enable-cxx CC=gcc  CXX=g++ CFLAGS='-g -O2'",
+      "makeCall": "make -j 12",
+      "sync": true
+    },
+    "linux32bit": {
+      "hostname": "ubuntu-32bit",
+      "configureCall": "./configure --with-netcdf ",
+      "makeCall": "make -j 3",
+      "username":"mpimet",
+      "sync": true
     }
   }
 }
diff --git a/ChangeLog b/ChangeLog
index 13ab8f0b885d891e87fb7ad7f6f4c88833272261..b01d03413f91522c010129f4949fb6de0c07619b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,11 @@
 	* using CDI library version 1.7.2
 	* Version 1.7.2 released
 
+2016-06-13  Uwe Schulzweida
+
+	* mul: wrong result for missval*0 (bug fix)
+	* expr: nmiss lost for time constant fields (bug fix)
+
 2016-06-07  Uwe Schulzweida
 
 	* select: file structure may change with time constant variables (bug fix)
diff --git a/NEWS b/NEWS
index 4c623d817c481a64152c3141cca8e0caf8beeab0..f8f8d36adf2ec55a4346812d9457b963ded945d5 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,7 @@ Version 1.7.2 (25 June 2016):
    Fixed bugs:
      * Error reading Gaussian reduced GRIB files [Bug #6780 #6819]
      * Installation error with OpenMP [Bug #6523]
+     * mul: wrong result for missval*0 (bug was introduced in 1.7.1)
      * shaded, contour, grfill: set NAN missvals to -9e33 [Bug: #6677]
 
 Version 1.7.1 (25 February 2016):
diff --git a/Rakefile b/Rakefile
index 3ac300e6408bca7e9933873514844684cbaafc10..9c03fb421f4123fa866071c768f09fcc1b4dba1d 100644
--- a/Rakefile
+++ b/Rakefile
@@ -15,10 +15,10 @@ if @userConfig.empty? then
   exit(1)
 end
 # get setup from the environment
-@debug               = true # == Rake.verbose ? true : false
+@debug               = Rake.application.options.silent ? false : true
 @user                = ENV['USER']
-# default configure call
-@defautConfigureCall = lambda {|cc| "./config/default CC=#{cc}"}
+# internal variables
+@_help = {}
 # }}}
 
 # helper methods {{{ ===========================================================
@@ -139,67 +139,95 @@ end
 #
 # construct task from builder object
 def builder2task(builder,useHostAsName=false,syncSource=true)
-  baseTaskName    = useHostAsName ? builder.host : "#{builder.host}#{builder.compiler.upcase}"
-  syncTaskName    = "#{baseTaskName}_sync"
-  configTaskName  = "#{baseTaskName}_conf"
-  buildTaskName   = "#{baseTaskName}_make"
-  cleanTaskName   = "#{baseTaskName}_clean"
-  checkTaskName   = "#{baseTaskName}_check"
-  checkVTaskName  = "#{baseTaskName}_checkV"
-  modlistTaskName = "#{baseTaskName}_mods"
-  showLogTaskName = "#{baseTaskName}_showLog"
+  baseTaskName = useHostAsName ? builder.host : "#{builder.host}#{builder.compiler.upcase}"
+  toDo         = lambda {|what| "#{baseTaskName}_#{what}".to_sym}
 
   if syncSource then
-    #desc "sync files for host: #{builder.host}, branch: #{getBranchName}"
-    task syncTaskName.to_sym do |t|
+    @_help[:sync] = "sync files for host: #{builder.host}, branch: #{getBranchName}" unless @_help.has_key?(:sync)
+    task toDo[:sync] do |t|
       dbg("sync source  code for branch:" + getBranchName)
       doSync(builder)
     end
   end
 
-  #desc "configure on host: %s, compiler %s, branch: %s" % [builder.host, builder.compiler, getBranchName]
-  task configTaskName.to_sym do |t|
+  @_help[:conf]= \
+    "configure on host: %s, compiler %s, branch: %s" % [builder.host, builder.compiler, getBranchName] unless @_help.has_key?(:conf)
+  task toDo[:conf] do |t|
     dbg("call #{builder.configureCall}")
     execute("#{builder.configureCall}",builder)
   end
 
-  #desc "build on host: %s, compiler %s, branch: %s" % [builder.host, builder.compiler, getBranchName]
-  task buildTaskName.to_sym do |t|
+  @_help[:make] = \
+    "build on host: %s, compiler %s, branch: %s" % [builder.host, builder.compiler, getBranchName] unless @_help.has_key?(:make)
+  task toDo[:make].to_sym do |t|
     execute("make -j4",builder)
   end
 
-  #desc "check on host: %s, compiler %s, branch: %s" % [builder.host, builder.compiler, getBranchName]
-  task checkTaskName.to_sym do |t|
+  @_help[:check] = \
+    "check on host: %s, compiler %s, branch: %s" % [builder.host, builder.compiler, getBranchName] unless @_help.has_key?(:check)
+  task toDo[:check] do |t|
     execute("make check",builder)
   end
 
-  #desc "build on host: %s, compiler %s, branch: %s" % [builder.host, builder.compiler, getBranchName]
-  task cleanTaskName.to_sym do |t|
+  @_help[:clean] = \
+    "build on host: %s, compiler %s, branch: %s" % [builder.host, builder.compiler, getBranchName] unless @_help.has_key?(:clean)
+  task toDo[:clean] do |t|
     execute("make clean",builder)
   end
 
-  #desc "check on host: %s, compiler %s, branch: %s" % [builder.host, builder.compiler, getBranchName]
-  task checkVTaskName.to_sym do |t|
+  @_help[:checkV] = \
+    "check on host: %s, compiler %s, branch: %s" % [builder.host, builder.compiler, getBranchName] unless @_help.has_key?(:checkV)
+  task toDo[:checkV] do |t|
     execute("./src/cdo -V",builder)
   end
 
-  # show remote config.log file
-  task showLogTaskName.to_sym do |t|
+  @_help[:showLog] = "show remote config.log file" unless @_help.has_key?(:make)
+  task toDo[:showLog] do |t|
     execute("cat config.log",builder)
   end
 
-  # get the auto loaded modules on the target machine
-  task modlistTaskName.to_sym do |t|
+  @_help[:cmd] = "execute command within the target build dir, e.g. rake localGCC_cmd['pwd']" unless @_help.has_key?(:cmd)
+  task toDo[:cmd] ,:cmd do |t, args|
+    warn "No command given!!" && exit(1) if args.cmd.nil?
+    execute(args.cmd,builder)
+  end
+
+  @_help[:mods] = "get the auto loaded modules on the target machine"
+  task toDo[:mods] do |t|
     execute("module list", builder)
   end
 
+  @_help[:log] = "log everything to <host|localTask>.log"
+  file baseTaskName+".log" do |t|
+    sh "rake #{baseTaskName} > #{t.name} 2>&1"
+    sh "finished".colorize(color: :green)
+  end
+
   desc builder.docstring
-  task baseTaskName.to_sym  => [syncSource ? syncTaskName : nil,
-                                configTaskName,
-                                buildTaskName,
-                                checkTaskName].compact.map(&:to_sym)
+  task baseTaskName.to_sym  => [syncSource ? toDo[:sync] : nil,
+                                toDo[:conf],
+                                toDo[:make],
+                                toDo[:check]].compact.map(&:to_sym)
 end
 # }}}
+def getUsername(builderConfig, hostConfig)
+  username = nil
+
+  username = @user if [builderConfig['hostname'],hostConfig['hostname']].include?('localhost')
+  return username unless username.nil?
+
+  username =  builderConfig['username'] if builderConfig.has_key?('username')
+  return username unless username.nil?
+
+  username = hostConfig['username'] if hostConfig.has_key?('username')
+  return username unless username.nil?
+
+  username = @userConfig["remoteUser"] if @userConfig.has_key?('remoteUser')
+  return username unless username.nil?
+
+  warn "Could not find username!!"
+  exit(1)
+end
 # constuct builders out of user configuration {{{ ==============================
 Builder = Struct.new(:host,:hostname,:username,:compiler,:targetDir,:configureCall,:isLocal?,:docstring)
 # 1) construct builders from host configuration
@@ -220,33 +248,42 @@ Builder = Struct.new(:host,:hostname,:username,:compiler,:targetDir,:configureCa
                          "builder on #{config['hostname']}, CC=#{cc}")
 
     builder2task(builder)
-  }
+  } if config.has_key?('CC')
 }
 # 2) construct builders from manual configuration
-@userConfig["builders"].each {|builderName,config|
+@userConfig["builders"].each {|builderName,builderConfig|
+  hostConfig = @userConfig['hosts'][builderConfig['hostname']]
+
+  warn "Hostconfig not found!!!!" and exit(1) if hostConfig.nil?
+
+  username, hostname = getUsername(builderConfig,hostConfig), hostConfig['hostname']
+
+  if username.nil? or hostname.nil? then
+    puts [username, hostname].join(' - ').colorize(color: :red)
+    warn "Missing connection info!"
+    exit(1)
+  else
+    puts [username, hostname].join(' - ').colorize(color: :green) if false
+  end
+
   builder = Builder.new(builderName,
-                        @userConfig['hosts'][config["hostname"]]['hostname'],
-                        ('localhost' == config['hostname'] \
-                                  or 'localhost' == @userConfig['hosts'][config['hostname']]['hostname']) \
-                            ? @user \
-                            : ( config.has_key?('username') \
-                               ? config['username'] \
-                               : @userConfig["remoteUser"]),
+                        hostname,
+                        username,
                         '', # CC can be empty here, because it should be set by the given configureCall
-                        [@userConfig['hosts'][config['hostname']]['dir'],builderName,getBranchName].join(File::SEPARATOR),
-                        config['configureCall'],
-                        ( 'localhost' == config['hostname'] \
-                           or 'localhost' == @userConfig['hosts'][config['hostname']]['hostname'] ),
-                       config.has_key?('docstring') \
-                         ? config['docstring'] \
-                         : "builder on #{config['hostname']}: #{config['configureCall']}")
+                        [hostConfig['dir'],builderName,getBranchName].join(File::SEPARATOR),
+                        builderConfig['configureCall'],
+                        [builderConfig['hostname'],hostConfig['hostname']].include?('localhost'),
+                        builderConfig.has_key?('docstring') \
+                          ? builderConfig['docstring'] \
+                          : "builder on #{builderConfig['hostname']}: #{builderConfig['configureCall']}")
 
-  builder2task(builder,true, config['sync'])
+  builder2task(builder,true, builderConfig['sync'])
 
 } if @userConfig.has_key?('builders')
 # }}}
 #
 
+desc "execute listed tasks in parallel, each of them in a separate xterm"
 task :par do |t|
   # remove all tasks from the stack
   Rake.application.top_level_tasks.clear
@@ -261,8 +298,19 @@ task :par do |t|
    sh "xterm -hold -e 'rake #{t}' "
   }
 end
+
+desc "show help on all hidden tasks"
+task :help do
+  @_help.each {|t,help|
+    sep = :log == t ? '.' : '_'
+    puts "rake <host|localTask>#{sep}#{t}".ljust(35,' ') + "# #{help}" }
+end
+
+task :default do |t|
+  sh "rake -sT"
+end
+
 # check connections {{{
-desc "check available connections"
 task :checkConnections do |t|
   pp Parallel.map(@userConfig["hosts"]) {|host, config|
     hostname = config['hostname']
@@ -286,7 +334,6 @@ end
 # }}}
 #
 # check internals {{{
-desc "check some internals"
 task :checkInterals do
   dbg(@srcDir)
   dbg(getBranchName)
diff --git a/configure b/configure
index 63aafc2928f888b41ad0c1be5eaf4b44e3cb3c3b..fb33c0c85e92223d02a887d8ad9c6770b4791d2b 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for cdo 1.7.2.
+# Generated by GNU Autoconf 2.68 for cdo 1.7.2rc6.
 #
 # Report bugs to <http://mpimet.mpg.de/cdo>.
 #
@@ -570,8 +570,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='cdo'
 PACKAGE_TARNAME='cdo'
-PACKAGE_VERSION='1.7.2'
-PACKAGE_STRING='cdo 1.7.2'
+PACKAGE_VERSION='1.7.2rc6'
+PACKAGE_STRING='cdo 1.7.2rc6'
 PACKAGE_BUGREPORT='http://mpimet.mpg.de/cdo'
 PACKAGE_URL=''
 
@@ -640,8 +640,6 @@ XML2_LIBS
 MAGICS_INCLUDE
 MAGICS_ROOT
 MAGICS_LIBS
-UDUNITS_INCLUDE
-UDUNITS_LDFLAGS
 CURL_INCLUDE
 CURL_LDFLAGS
 PROJ_INCLUDE
@@ -655,6 +653,8 @@ ENABLE_GRIBAPI
 GRIB_API_LIBS
 GRIB_API_INCLUDE
 CMOR_LIBS
+UDUNITS_INCLUDE
+UDUNITS_LDFLAGS
 NETCDF_LIBS
 NETCDF_INCLUDE
 NETCDF_ROOT
@@ -823,6 +823,7 @@ with_threads
 with_szlib
 with_hdf5
 with_netcdf
+with_udunits2
 with_cmor
 with_grib_api
 enable_grib
@@ -833,7 +834,6 @@ enable_ieg
 with_fftw3
 with_proj
 with_curl
-with_udunits2
 with_magics
 with_libxml2
 enable_cdi_lib
@@ -1395,7 +1395,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures cdo 1.7.2 to adapt to many kinds of systems.
+\`configure' configures cdo 1.7.2rc6 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1465,7 +1465,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of cdo 1.7.2:";;
+     short | recursive ) echo "Configuration of cdo 1.7.2rc6:";;
    esac
   cat <<\_ACEOF
 
@@ -1518,6 +1518,8 @@ Optional Packages:
                           location of HDF5 library
   --with-netcdf=<yes|no|directory> (default=no)
                           location of NetCDF library (lib and include subdirs)
+  --with-udunits2=<directory>
+                          Specify location of UDUNITS2 library.
   --with-cmor=<directory> Specify location of CMOR library.
   --with-grib_api=<yes|no|directory> (default=no)
                           location of GRIB_API library (lib and include
@@ -1526,8 +1528,6 @@ Optional Packages:
   --with-proj=<directory> Specify location of PROJ library for cartographic
                           projections.
   --with-curl=<directory> Specify location of CURL library.
-  --with-udunits2=<directory>
-                          Specify location of UDUNITS2 library.
   --with-magics=<yes|no|directory>
                           location of magics library (lib and include subdirs)
   --with-libxml2=<yes|no|directory>
@@ -1613,7 +1613,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-cdo configure 1.7.2
+cdo configure 1.7.2rc6
 generated by GNU Autoconf 2.68
 
 Copyright (C) 2010 Free Software Foundation, Inc.
@@ -2206,7 +2206,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by cdo $as_me 1.7.2, which was
+It was created by cdo $as_me 1.7.2rc6, which was
 generated by GNU Autoconf 2.68.  Invocation command line was
 
   $ $0 $@
@@ -3155,7 +3155,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='cdo'
- VERSION='1.7.2'
+ VERSION='1.7.2rc6'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -19242,6 +19242,200 @@ fi
 
 
 
+#  ----------------------------------------------------------------------
+#  Link application with UDUNITS2 library
+
+# Check whether --with-udunits2 was given.
+if test "${with_udunits2+set}" = set; then :
+  withval=$with_udunits2; case "$with_udunits2" in #(
+  no) :
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for udunits2 library" >&5
+$as_echo_n "checking for udunits2 library... " >&6; }
+                           { $as_echo "$as_me:${as_lineno-$LINENO}: result: suppressed" >&5
+$as_echo "suppressed" >&6; } ;; #(
+  yes) :
+    for ac_header in udunits2.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "udunits2.h" "ac_cv_header_udunits2_h" "$ac_includes_default"
+if test "x$ac_cv_header_udunits2_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_UDUNITS2_H 1
+_ACEOF
+
+fi
+
+done
+
+                            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing ut_parse" >&5
+$as_echo_n "checking for library containing ut_parse... " >&6; }
+if ${ac_cv_search_ut_parse+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char ut_parse ();
+int
+main ()
+{
+return ut_parse ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' udunits2; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_ut_parse=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_ut_parse+:} false; then :
+  break
+fi
+done
+if ${ac_cv_search_ut_parse+:} false; then :
+
+else
+  ac_cv_search_ut_parse=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_ut_parse" >&5
+$as_echo "$ac_cv_search_ut_parse" >&6; }
+ac_res=$ac_cv_search_ut_parse
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+$as_echo "#define HAVE_LIBUDUNITS2 1" >>confdefs.h
+
+else
+  as_fn_error $? "Could not link to udunits2 library!" "$LINENO" 5
+fi
+
+                            UDUNITS_LDFLAGS=" -ludunits2"
+
+                            UDUNITS_INCLUDE=""
+ ;; #(
+  *) :
+    UDUNITS_ROOT=$with_udunits2
+                          if test -d "$UDUNITS_ROOT"; then :
+  LDFLAGS="$LDFLAGS -L$UDUNITS_ROOT/lib"
+                                 CPPFLAGS="$CPPFLAGS -I$UDUNITS_ROOT/include"
+                                 for ac_header in udunits2.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "udunits2.h" "ac_cv_header_udunits2_h" "$ac_includes_default"
+if test "x$ac_cv_header_udunits2_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_UDUNITS2_H 1
+_ACEOF
+
+fi
+
+done
+
+                                 for ac_header in udunits2/udunits2.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "udunits2/udunits2.h" "ac_cv_header_udunits2_udunits2_h" "$ac_includes_default"
+if test "x$ac_cv_header_udunits2_udunits2_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_UDUNITS2_UDUNITS2_H 1
+_ACEOF
+
+fi
+
+done
+
+                                 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing ut_parse" >&5
+$as_echo_n "checking for library containing ut_parse... " >&6; }
+if ${ac_cv_search_ut_parse+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char ut_parse ();
+int
+main ()
+{
+return ut_parse ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' udunits2; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_ut_parse=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_ut_parse+:} false; then :
+  break
+fi
+done
+if ${ac_cv_search_ut_parse+:} false; then :
+
+else
+  ac_cv_search_ut_parse=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_ut_parse" >&5
+$as_echo "$ac_cv_search_ut_parse" >&6; }
+ac_res=$ac_cv_search_ut_parse
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+$as_echo "#define HAVE_LIBUDUNITS2 1" >>confdefs.h
+
+else
+  as_fn_error $? "Could not link to udunits2 library!" "$LINENO" 5
+fi
+
+                                 UDUNITS_LDFLAGS=" -L$UDUNITS_ROOT/lib -ludunits2"
+
+                                 UDUNITS_INCLUDE=" -I$UDUNITS_ROOT/include"
+
+else
+  as_fn_error $? "$UDUNITS_ROOT is not a directory! UDUNITS2 suppressed" "$LINENO" 5
+fi ;; #(
+  *) :
+     ;;
+esac
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the UDUNITS2 library" >&5
+$as_echo_n "checking for the UDUNITS2 library... " >&6; }
+             { $as_echo "$as_me:${as_lineno-$LINENO}: result: suppressed" >&5
+$as_echo "suppressed" >&6; }
+fi
+
 #  ----------------------------------------------------------------------
 #  Link application with CMOR library
 CMOR_LIBS=''
@@ -20161,200 +20355,6 @@ $as_echo_n "checking for the CURL library... " >&6; }
 $as_echo "suppressed" >&6; }
 fi
 
-#  ----------------------------------------------------------------------
-#  Link application with UDUNITS2 library
-
-# Check whether --with-udunits2 was given.
-if test "${with_udunits2+set}" = set; then :
-  withval=$with_udunits2; case "$with_udunits2" in #(
-  no) :
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for udunits2 library" >&5
-$as_echo_n "checking for udunits2 library... " >&6; }
-                           { $as_echo "$as_me:${as_lineno-$LINENO}: result: suppressed" >&5
-$as_echo "suppressed" >&6; } ;; #(
-  yes) :
-    for ac_header in udunits2.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "udunits2.h" "ac_cv_header_udunits2_h" "$ac_includes_default"
-if test "x$ac_cv_header_udunits2_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_UDUNITS2_H 1
-_ACEOF
-
-fi
-
-done
-
-                            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing ut_parse" >&5
-$as_echo_n "checking for library containing ut_parse... " >&6; }
-if ${ac_cv_search_ut_parse+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char ut_parse ();
-int
-main ()
-{
-return ut_parse ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' udunits2; do
-  if test -z "$ac_lib"; then
-    ac_res="none required"
-  else
-    ac_res=-l$ac_lib
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-  fi
-  if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_search_ut_parse=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext
-  if ${ac_cv_search_ut_parse+:} false; then :
-  break
-fi
-done
-if ${ac_cv_search_ut_parse+:} false; then :
-
-else
-  ac_cv_search_ut_parse=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_ut_parse" >&5
-$as_echo "$ac_cv_search_ut_parse" >&6; }
-ac_res=$ac_cv_search_ut_parse
-if test "$ac_res" != no; then :
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-
-$as_echo "#define HAVE_LIBUDUNITS2 1" >>confdefs.h
-
-else
-  as_fn_error $? "Could not link to udunits2 library!" "$LINENO" 5
-fi
-
-                            UDUNITS_LDFLAGS=" -ludunits2"
-
-                            UDUNITS_INCLUDE=""
- ;; #(
-  *) :
-    UDUNITS_ROOT=$with_udunits2
-                          if test -d "$UDUNITS_ROOT"; then :
-  LDFLAGS="$LDFLAGS -L$UDUNITS_ROOT/lib"
-                                 CPPFLAGS="$CPPFLAGS -I$UDUNITS_ROOT/include"
-                                 for ac_header in udunits2.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "udunits2.h" "ac_cv_header_udunits2_h" "$ac_includes_default"
-if test "x$ac_cv_header_udunits2_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_UDUNITS2_H 1
-_ACEOF
-
-fi
-
-done
-
-                                 for ac_header in udunits2/udunits2.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "udunits2/udunits2.h" "ac_cv_header_udunits2_udunits2_h" "$ac_includes_default"
-if test "x$ac_cv_header_udunits2_udunits2_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_UDUNITS2_UDUNITS2_H 1
-_ACEOF
-
-fi
-
-done
-
-                                 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing ut_parse" >&5
-$as_echo_n "checking for library containing ut_parse... " >&6; }
-if ${ac_cv_search_ut_parse+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char ut_parse ();
-int
-main ()
-{
-return ut_parse ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' udunits2; do
-  if test -z "$ac_lib"; then
-    ac_res="none required"
-  else
-    ac_res=-l$ac_lib
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-  fi
-  if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_search_ut_parse=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext
-  if ${ac_cv_search_ut_parse+:} false; then :
-  break
-fi
-done
-if ${ac_cv_search_ut_parse+:} false; then :
-
-else
-  ac_cv_search_ut_parse=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_ut_parse" >&5
-$as_echo "$ac_cv_search_ut_parse" >&6; }
-ac_res=$ac_cv_search_ut_parse
-if test "$ac_res" != no; then :
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-
-$as_echo "#define HAVE_LIBUDUNITS2 1" >>confdefs.h
-
-else
-  as_fn_error $? "Could not link to udunits2 library!" "$LINENO" 5
-fi
-
-                                 UDUNITS_LDFLAGS=" -L$UDUNITS_ROOT/lib -ludunits2"
-
-                                 UDUNITS_INCLUDE=" -I$UDUNITS_ROOT/include"
-
-else
-  as_fn_error $? "$UDUNITS_ROOT is not a directory! UDUNITS2 suppressed" "$LINENO" 5
-fi ;; #(
-  *) :
-     ;;
-esac
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the UDUNITS2 library" >&5
-$as_echo_n "checking for the UDUNITS2 library... " >&6; }
-             { $as_echo "$as_me:${as_lineno-$LINENO}: result: suppressed" >&5
-$as_echo "suppressed" >&6; }
-fi
-
 #  ----------------------------------------------------------------------
 #  Compile application with MAGICS (xml required)
 MAGICS_ROOT=''
@@ -21062,7 +21062,7 @@ ac_config_files="$ac_config_files test/Select.test test/Spectral.test test/Timst
 
 ac_config_files="$ac_config_files test/Ymonstat.test test/Fldstat.test test/Fldpctl.test test/Ensstat.test test/Enspctl.test"
 
-ac_config_files="$ac_config_files test/Afterburner.test test/Detrend.test test/Arith.test test/Expr.test"
+ac_config_files="$ac_config_files test/Afterburner.test test/Detrend.test test/Arithc.test test/Arith.test test/Expr.test"
 
 ac_config_files="$ac_config_files test/Gradsdes.test test/Collgrid.test test/threads.test test/tsformat.test test/wildcard.test"
 
@@ -21644,7 +21644,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by cdo $as_me 1.7.2, which was
+This file was extended by cdo $as_me 1.7.2rc6, which was
 generated by GNU Autoconf 2.68.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -21710,7 +21710,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-cdo config.status 1.7.2
+cdo config.status 1.7.2rc6
 configured by $0, generated by GNU Autoconf 2.68,
   with options \\"\$ac_cs_config\\"
 
@@ -22236,6 +22236,7 @@ do
     "test/Enspctl.test") CONFIG_FILES="$CONFIG_FILES test/Enspctl.test" ;;
     "test/Afterburner.test") CONFIG_FILES="$CONFIG_FILES test/Afterburner.test" ;;
     "test/Detrend.test") CONFIG_FILES="$CONFIG_FILES test/Detrend.test" ;;
+    "test/Arithc.test") CONFIG_FILES="$CONFIG_FILES test/Arithc.test" ;;
     "test/Arith.test") CONFIG_FILES="$CONFIG_FILES test/Arith.test" ;;
     "test/Expr.test") CONFIG_FILES="$CONFIG_FILES test/Expr.test" ;;
     "test/Gradsdes.test") CONFIG_FILES="$CONFIG_FILES test/Gradsdes.test" ;;
@@ -23756,6 +23757,7 @@ _LT_EOF
     "test/Enspctl.test":F) chmod a+x "$ac_file" ;;
     "test/Afterburner.test":F) chmod a+x "$ac_file" ;;
     "test/Detrend.test":F) chmod a+x "$ac_file" ;;
+    "test/Arithc.test":F) chmod a+x "$ac_file" ;;
     "test/Arith.test":F) chmod a+x "$ac_file" ;;
     "test/Expr.test":F) chmod a+x "$ac_file" ;;
     "test/Gradsdes.test":F) chmod a+x "$ac_file" ;;
diff --git a/configure.ac b/configure.ac
index 2786631a241d0f7318a9036ddc6e37fdc70a1bd7..bd68f0a05f48ca95be02531d6b387c44a424ffb7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,7 +4,7 @@
 #  autoconf 2.68
 #  libtool  2.4.2
 
-AC_INIT([cdo], [1.7.2], [http://mpimet.mpg.de/cdo])
+AC_INIT([cdo], [1.7.2rc6], [http://mpimet.mpg.de/cdo])
 
 AC_DEFINE_UNQUOTED(CDO, ["$PACKAGE_VERSION"], [CDO version])
 
@@ -251,7 +251,7 @@ AC_CONFIG_FILES([test/File.test test/Read_grib.test test/Read_netcdf.test test/C
 AC_CONFIG_FILES([test/Cat.test test/Gridarea.test test/Genweights.test test/Remap.test],[chmod a+x "$ac_file"])
 AC_CONFIG_FILES([test/Select.test test/Spectral.test test/Timstat.test test/Vertint.test],[chmod a+x "$ac_file"])
 AC_CONFIG_FILES([test/Ymonstat.test test/Fldstat.test test/Fldpctl.test test/Ensstat.test test/Enspctl.test],[chmod a+x "$ac_file"])
-AC_CONFIG_FILES([test/Afterburner.test test/Detrend.test test/Arith.test test/Expr.test],[chmod a+x "$ac_file"])
+AC_CONFIG_FILES([test/Afterburner.test test/Detrend.test test/Arithc.test test/Arith.test test/Expr.test],[chmod a+x "$ac_file"])
 AC_CONFIG_FILES([test/Gradsdes.test test/Collgrid.test test/threads.test test/tsformat.test test/wildcard.test],[chmod a+x "$ac_file"])
 AC_CONFIG_FILES([test/MapReduce.test test/Ninfo.test],[chmod a+x "$ac_file"])
 AC_CONFIG_FILES([Makefile src/Makefile contrib/Makefile test/Makefile test/data/Makefile cdo.spec cdo.settings])
diff --git a/m4/acx_options.m4 b/m4/acx_options.m4
index 532076e8f51acdca8bea30f1896720f506cd1592..b4068d3aff612899e0a92eb25708e30c8772a26c 100644
--- a/m4/acx_options.m4
+++ b/m4/acx_options.m4
@@ -200,6 +200,36 @@ AC_SUBST([NETCDF_ROOT])
 AC_SUBST([NETCDF_INCLUDE])
 AC_SUBST([NETCDF_LIBS])
 #  ----------------------------------------------------------------------
+#  Link application with UDUNITS2 library
+AC_ARG_WITH([udunits2],
+            [AS_HELP_STRING([--with-udunits2=<directory>],
+                            [Specify location of UDUNITS2 library.])],
+            [AS_CASE(["$with_udunits2"],
+                     [no],[AC_MSG_CHECKING([for udunits2 library])
+                           AC_MSG_RESULT([suppressed])],
+                     [yes],[AC_CHECK_HEADERS([udunits2.h])
+                            AC_SEARCH_LIBS([ut_parse],
+                                           [udunits2],
+                                           [AC_DEFINE([HAVE_LIBUDUNITS2],[1],[Define to 1 for UDUNITS2 support])],
+                                           [AC_MSG_ERROR([Could not link to udunits2 library!])])
+                            AC_SUBST([UDUNITS_LDFLAGS],[" -ludunits2"])
+                            AC_SUBST([UDUNITS_INCLUDE],[""])],
+                     [*],[UDUNITS_ROOT=$with_udunits2
+                          AS_IF([test -d "$UDUNITS_ROOT"],
+                                [LDFLAGS="$LDFLAGS -L$UDUNITS_ROOT/lib"
+                                 CPPFLAGS="$CPPFLAGS -I$UDUNITS_ROOT/include"
+                                 AC_CHECK_HEADERS([udunits2.h])
+                                 AC_CHECK_HEADERS([udunits2/udunits2.h])
+                                 AC_SEARCH_LIBS([ut_parse],
+                                                [udunits2],
+                                                [AC_DEFINE([HAVE_LIBUDUNITS2],[1],[Define to 1 for UDUNITS2 support])],
+                                                [AC_MSG_ERROR([Could not link to udunits2 library!])])
+                                 AC_SUBST([UDUNITS_LDFLAGS],[" -L$UDUNITS_ROOT/lib -ludunits2"])
+                                 AC_SUBST([UDUNITS_INCLUDE],[" -I$UDUNITS_ROOT/include"])],
+                                [AC_MSG_ERROR([$UDUNITS_ROOT is not a directory! UDUNITS2 suppressed])])])],
+            [AC_MSG_CHECKING([for the UDUNITS2 library])
+             AC_MSG_RESULT([suppressed])])
+#  ----------------------------------------------------------------------
 #  Link application with CMOR library
 CMOR_LIBS=''
 AC_ARG_WITH([cmor],
@@ -389,36 +419,6 @@ AC_ARG_WITH([curl],
             [AC_MSG_CHECKING([for the CURL library])
              AC_MSG_RESULT([suppressed])])
 #  ----------------------------------------------------------------------
-#  Link application with UDUNITS2 library
-AC_ARG_WITH([udunits2],
-            [AS_HELP_STRING([--with-udunits2=<directory>],
-                            [Specify location of UDUNITS2 library.])],
-            [AS_CASE(["$with_udunits2"],
-                     [no],[AC_MSG_CHECKING([for udunits2 library])
-                           AC_MSG_RESULT([suppressed])],
-                     [yes],[AC_CHECK_HEADERS([udunits2.h])
-                            AC_SEARCH_LIBS([ut_parse],
-                                           [udunits2],
-                                           [AC_DEFINE([HAVE_LIBUDUNITS2],[1],[Define to 1 for UDUNITS2 support])],
-                                           [AC_MSG_ERROR([Could not link to udunits2 library!])])
-                            AC_SUBST([UDUNITS_LDFLAGS],[" -ludunits2"])
-                            AC_SUBST([UDUNITS_INCLUDE],[""])],
-                     [*],[UDUNITS_ROOT=$with_udunits2
-                          AS_IF([test -d "$UDUNITS_ROOT"],
-                                [LDFLAGS="$LDFLAGS -L$UDUNITS_ROOT/lib"
-                                 CPPFLAGS="$CPPFLAGS -I$UDUNITS_ROOT/include"
-                                 AC_CHECK_HEADERS([udunits2.h])
-                                 AC_CHECK_HEADERS([udunits2/udunits2.h])
-                                 AC_SEARCH_LIBS([ut_parse],
-                                                [udunits2],
-                                                [AC_DEFINE([HAVE_LIBUDUNITS2],[1],[Define to 1 for UDUNITS2 support])],
-                                                [AC_MSG_ERROR([Could not link to udunits2 library!])])
-                                 AC_SUBST([UDUNITS_LDFLAGS],[" -L$UDUNITS_ROOT/lib -ludunits2"])
-                                 AC_SUBST([UDUNITS_INCLUDE],[" -I$UDUNITS_ROOT/include"])],
-                                [AC_MSG_ERROR([$UDUNITS_ROOT is not a directory! UDUNITS2 suppressed])])])],
-            [AC_MSG_CHECKING([for the UDUNITS2 library])
-             AC_MSG_RESULT([suppressed])])
-#  ----------------------------------------------------------------------
 #  Compile application with MAGICS (xml required)
 MAGICS_ROOT=''
 MAGICS_INCLUDE=''
diff --git a/src/Collgrid.c b/src/Collgrid.c
index ddcecb03d4913c502c9670dd4871c6e417017833..e5085bcdbca2c0fccdebdb8b6545323519cfe191 100644
--- a/src/Collgrid.c
+++ b/src/Collgrid.c
@@ -82,12 +82,12 @@ int cmpxy_gt(const void *s1, const void *s2)
 static
 int genGrid(int nfiles, ens_file_t *ef, int **gridindex, int igrid, int nxblocks)
 {
-  int lsouthnorth = TRUE;
+  bool lsouthnorth = true;
+  bool lregular = false;
+  bool lcurvilinear = false;
   int gridID2 = -1;
   int idx;
   int ny, ix, iy, i, j, ij, offset;
-  int lregular = FALSE;
-  int lcurvilinear = FALSE;
   double *xvals2 = NULL, *yvals2 = NULL;
 
   int nx = -1;
@@ -109,9 +109,9 @@ int genGrid(int nfiles, ens_file_t *ef, int **gridindex, int igrid, int nxblocks
       gridID   = vlistGrid(ef[fileID].vlistID, igrid);
       gridtype = gridInqType(gridID);
       if ( gridtype == GRID_LONLAT || gridtype == GRID_GAUSSIAN )
-        lregular = TRUE;
+        lregular = true;
       else if ( gridtype == GRID_CURVILINEAR )
-        lcurvilinear = TRUE;
+        lcurvilinear = true;
       else if ( gridtype == GRID_GENERIC && gridInqXsize(gridID) > 0 && gridInqYsize(gridID) > 0 )
         ;
       else
@@ -151,7 +151,7 @@ int genGrid(int nfiles, ens_file_t *ef, int **gridindex, int igrid, int nxblocks
 
           if ( ysize[fileID] > 1 )
             {
-              if ( yvals[fileID][0] > yvals[fileID][ysize[fileID]-1] ) lsouthnorth = FALSE;
+              if ( yvals[fileID][0] > yvals[fileID][ysize[fileID]-1] ) lsouthnorth = false;
             }
         }
       else
@@ -342,10 +342,10 @@ void *Collgrid(void *argument)
     vlistCompare(vlistID1, ef[fileID].vlistID, CMP_NAME | CMP_NLEVEL);
 
   int nvars = vlistNvars(vlistID1);
-  int *vars  = (int*) Malloc(nvars*sizeof(int));
-  for ( varID = 0; varID < nvars; varID++ ) vars[varID] = FALSE;
-  int *vars1  = (int*) Malloc(nvars*sizeof(int));
-  for ( varID = 0; varID < nvars; varID++ ) vars1[varID] = FALSE;
+  bool *vars  = (bool*) Malloc(nvars*sizeof(bool));
+  for ( varID = 0; varID < nvars; varID++ ) vars[varID] = false;
+  bool *vars1  = (bool*) Malloc(nvars*sizeof(bool));
+  for ( varID = 0; varID < nvars; varID++ ) vars1[varID] = false;
 
   int nsel = operatorArgc();
 
@@ -363,7 +363,7 @@ void *Collgrid(void *argument)
 
   if ( nsel == 0 )
     {
-      for ( varID = 0; varID < nvars; varID++ ) vars1[varID] = TRUE;
+      for ( varID = 0; varID < nvars; varID++ ) vars1[varID] = true;
     }
   else
     {
@@ -373,8 +373,8 @@ void *Collgrid(void *argument)
 	for ( int i = 0; i < nsel; i++ )
 	  fprintf(stderr, "name %d = %s\n", i+1, argnames[i]);
 
-      int *selfound = (int*) Malloc(nsel*sizeof(int));
-      for ( int i = 0; i < nsel; i++ ) selfound[i] = FALSE;
+      bool *selfound = (bool*) Malloc(nsel*sizeof(bool));
+      for ( int i = 0; i < nsel; i++ ) selfound[i] = false;
 
       char varname[CDI_MAX_NAME];
       for ( varID = 0; varID < nvars; varID++ )
@@ -385,14 +385,14 @@ void *Collgrid(void *argument)
 	    {
 	      if ( strcmp(argnames[isel], varname) == 0 )
 		{
-		  selfound[isel] = TRUE;
-		  vars1[varID] = TRUE;
+		  selfound[isel] = true;
+		  vars1[varID] = true;
 		}
 	    }
 	}
 
       for ( int isel = 0; isel < nsel; isel++ )
-	if ( selfound[isel] == FALSE )
+	if ( selfound[isel] == false )
 	  cdoAbort("Variable name %s not found!", argnames[isel]);
 
       Free(selfound);
@@ -400,7 +400,7 @@ void *Collgrid(void *argument)
 
   for ( varID = 0; varID < nvars; varID++ )
     {
-      if ( vars1[varID] == TRUE )
+      if ( vars1[varID] )
 	{
 	  int zaxisID  = vlistInqVarZaxis(vlistID1, varID);
 	  int nlevs    = zaxisInqSize(zaxisID);
@@ -433,7 +433,7 @@ void *Collgrid(void *argument)
   //int vlistID2 = vlistDuplicate(vlistID1);
   int nvars2 = vlistNvars(vlistID2);
   // int *vars  = (int*) Malloc(nvars*sizeof(int));
-  //for ( varID = 0; varID < nvars; varID++ ) vars[varID] = FALSE;
+  //for ( varID = 0; varID < nvars; varID++ ) vars[varID] = false;
 
   int ngrids1 = vlistNgrids(vlistID1);
   int ngrids2 = vlistNgrids(vlistID2);
@@ -443,7 +443,7 @@ void *Collgrid(void *argument)
   for ( int fileID = 0; fileID < nfiles; fileID++ )
     gridindex[fileID] = (int*) Malloc(gridsizemax*sizeof(int));
 
-  int ginit = FALSE;
+  bool ginit = false;
   for ( int i2 = 0; i2 < ngrids2; ++i2 )
     {
       int i1;
@@ -452,10 +452,10 @@ void *Collgrid(void *argument)
 
       //   printf("i1 %d i2 %d\n", i1, i2);
 
-      if ( ginit == FALSE )
+      if ( !ginit )
 	{
 	  gridIDs[i2] = genGrid(nfiles, ef, gridindex, i1, nxblocks);
-	  if ( gridIDs[i2] != -1 ) ginit = TRUE;
+	  if ( gridIDs[i2] != -1 ) ginit = true;
 	}
       else
 	gridIDs[i2] = genGrid(nfiles, ef, NULL, i1, nxblocks);
@@ -485,7 +485,7 @@ void *Collgrid(void *argument)
 	{
 	  if ( gridIDs[i] != -1 ) 
 	    {
-	      if ( gridID == vlistGrid(vlistID2, i) ) vars[varID] = TRUE;
+	      if ( gridID == vlistGrid(vlistID2, i) ) vars[varID] = true;
 	      break;
 	    }
 	}
diff --git a/src/Exprf.c b/src/Exprf.c
index a606ef446f8ee1af4e11b7dc78470950db4a00d7..545492c8753119bfc1a68e3261b03bed0793b90c 100644
--- a/src/Exprf.c
+++ b/src/Exprf.c
@@ -493,7 +493,9 @@ void *Expr(void *argument)
 
       streamDefTimestep(streamID2, tsID);
 
-      for ( int varID = 0; varID < nvars1; varID++ ) params[varID].nmiss = 0;
+      for ( int varID = 0; varID < nvars1; varID++ )
+        if ( tsID == 0 || params[varID].steptype != TIME_CONSTANT )
+          params[varID].nmiss = 0;
 
       for ( int recID = 0; recID < nrecs; recID++ )
 	{
diff --git a/src/Setpartab.c b/src/Setpartab.c
index 33c30ee443ba52c47f54f5255b61f5928daeb112..af902b213f043bbd18bfd7ebefbe52471367d8e8 100644
--- a/src/Setpartab.c
+++ b/src/Setpartab.c
@@ -174,26 +174,26 @@ void *get_converter(char *src_unit_str, char *tgt_unit_str, int *rstatus)
 
 typedef struct
 {
-  int convert;
-  int remove;
+  bool convert;
+  bool remove;
   // missing value
-  int changemissval;
+  bool changemissval;
   double missval_old;
   //
-  int lfactor;
+  bool lfactor;
   double factor;
   //
-  int checkvalid;
+  bool checkvalid;
   double valid_min;
   double valid_max;
   //
-  int check_min_mean_abs;
+  bool check_min_mean_abs;
   double ok_min_mean_abs;
   //
-  int check_max_mean_abs;
+  bool check_max_mean_abs;
   double ok_max_mean_abs;
   // units
-  int changeunits;
+  bool changeunits;
   char units_old[CDI_MAX_NAME];
   char units[CDI_MAX_NAME];
   // varname
@@ -213,9 +213,9 @@ void defineVarAttText(int vlistID2, int varID, const char *attname, const char *
 static
 void convertVarUnits(var_t *vars, int varID, char *name)
 {
-  if ( vars[varID].convert == FALSE ) vars[varID].changeunits = FALSE;
+  if ( vars[varID].convert == false ) vars[varID].changeunits = false;
 
-  if ( vars[varID].changeunits == TRUE )
+  if ( vars[varID].changeunits )
     {
       char *units = vars[varID].units;
       char *units_old = vars[varID].units_old;
@@ -238,7 +238,7 @@ void convertVarUnits(var_t *vars, int varID, char *name)
 	    }
 	  else
 	    cdoWarning("%s - converting units from [%s] to [%s] failed!", name, units_old, units);
-	  vars[varID].changeunits = FALSE;
+	  vars[varID].changeunits = false;
 	}
       else
 	{
@@ -250,12 +250,12 @@ void convertVarUnits(var_t *vars, int varID, char *name)
 	    }
 	}
 #else
-      static int lwarn_udunits = TRUE;
+      static bool lwarn_udunits = true;
       if ( lwarn_udunits )
 	{
 	  cdoWarning("%s - converting units from [%s] to [%s] failed, UDUNITS2 support not compiled in!", name,units_old, units);
-	  vars[varID].changeunits = FALSE;
-	  lwarn_udunits = FALSE;
+	  vars[varID].changeunits = false;
+	  lwarn_udunits = false;
 	}
 #endif
     }
@@ -274,7 +274,7 @@ void defineVarUnits(var_t *vars, int vlistID2, int varID, char *units)
     {
       if ( len1 > 0 && len2 > 0 )
 	{
-	  vars[varID].changeunits = TRUE;
+	  vars[varID].changeunits = true;
 	  strcpy(vars[varID].units_old, units_old);
 	  strcpy(vars[varID].units, units);
 	}
@@ -293,7 +293,7 @@ void read_partab(pt_mode_t ptmode, int nvars, int vlistID2, var_t *vars)
   int nml_longname, nml_units, nml_comment, nml_ltype, nml_delete, nml_convert, nml_missval, nml_factor;
   int nml_cell_methods, nml_cell_measures;
   int nml_valid_min, nml_valid_max, nml_ok_min_mean_abs, nml_ok_max_mean_abs;
-  int locc, i;
+  int i;
   int code, out_code, table, ltype, remove, convert;
   int nml_index = 0;
   int codenum, tabnum, levtype, param;
@@ -359,10 +359,10 @@ void read_partab(pt_mode_t ptmode, int nvars, int vlistID2, var_t *vars)
 
 	  if ( cdoVerbose ) namelistPrint(nml);
 
-	  locc = FALSE;
+	  bool locc = false;
 	  for ( i = 0; i < nml->size; i++ )
 	    {
-	      if ( nml->entry[i]->occ ) { locc = TRUE; break; }
+	      if ( nml->entry[i]->occ ) { locc = true; break; }
 	    }
 
 	  if ( locc )
@@ -446,8 +446,8 @@ void read_partab(pt_mode_t ptmode, int nvars, int vlistID2, var_t *vars)
 		  if ( nml->entry[nml_comment]->occ  )  defineVarAttText(vlistID2, varID, "comment", comment);
 		  if ( nml->entry[nml_cell_methods]->occ  ) defineVarAttText(vlistID2, varID, "cell_methods", cell_methods);
 		  if ( nml->entry[nml_cell_measures]->occ ) defineVarAttText(vlistID2, varID, "cell_measures", cell_measures);
-		  if ( nml->entry[nml_delete]->occ && remove == 1 ) vars[varID].remove = TRUE;
-		  if ( nml->entry[nml_convert]->occ )   vars[varID].convert = convert==0 ? FALSE : TRUE;
+		  if ( nml->entry[nml_delete]->occ && remove == 1 ) vars[varID].remove = true;
+		  if ( nml->entry[nml_convert]->occ )   vars[varID].convert = convert==0 ? false : true;
 		  if ( nml->entry[nml_param]->occ )     vlistDefVarParam(vlistID2, varID, stringToParam(paramstr));
 		  if ( nml->entry[nml_out_param]->occ ) vlistDefVarParam(vlistID2, varID, stringToParam(out_paramstr));
 		  if ( nml->entry[nml_datatype]->occ )
@@ -468,32 +468,32 @@ void read_partab(pt_mode_t ptmode, int nvars, int vlistID2, var_t *vars)
 			{
 			  if ( cdoVerbose ) 
 			    cdoPrint("%s - change missval from %g to %g", name, missval_old, missval);
-			  vars[varID].changemissval = TRUE;
+			  vars[varID].changemissval = true;
 			  vars[varID].missval_old = missval_old;
 			  vlistDefVarMissval(vlistID2, varID, missval);
 			}
 		    }
 		  if ( nml->entry[nml_factor]->occ )
 		    {
-		      vars[varID].lfactor = TRUE;
+		      vars[varID].lfactor = true;
 		      vars[varID].factor = factor;
 		      if ( cdoVerbose ) 
 			cdoPrint("%s - scale factor %g", name, factor);
 		    }
 		  if ( nml->entry[nml_valid_min]->occ && nml->entry[nml_valid_max]->occ )
 		    {
-		      vars[varID].checkvalid = TRUE;
+		      vars[varID].checkvalid = true;
 		      vars[varID].valid_min = valid_min;
 		      vars[varID].valid_max = valid_max;
 		    }
 		  if ( nml->entry[nml_ok_min_mean_abs]->occ )
 		    {
-		      vars[varID].check_min_mean_abs = TRUE;
+		      vars[varID].check_min_mean_abs = true;
 		      vars[varID].ok_min_mean_abs = ok_min_mean_abs;
 		    }
 		  if ( nml->entry[nml_ok_max_mean_abs]->occ )
 		    {
-		      vars[varID].check_max_mean_abs = TRUE;
+		      vars[varID].check_max_mean_abs = true;
 		      vars[varID].ok_max_mean_abs = ok_max_mean_abs;
 		    }
 		}
@@ -600,7 +600,7 @@ void *Setpartab(void *argument)
   int nrecs;
   int varID, levelID;
   int nmiss;
-  int delvars = FALSE;
+  bool delvars = false;
   int tableID = -1;
   int tableformat = 0;
   double missval;
@@ -618,10 +618,10 @@ void *Setpartab(void *argument)
 
   if ( operatorArgc() < 1 ) cdoAbort("Too few arguments!");
 
-  int convert_data = FALSE;
+  bool convert_data = false;
   if ( operatorArgc() == 2 )
     {
-      if ( strcmp("convert", operatorArgv()[1]) == 0 ) convert_data = TRUE;
+      if ( strcmp("convert", operatorArgv()[1]) == 0 ) convert_data = true;
       else cdoAbort("Unknown parameter: >%s<", operatorArgv()[1]); 
     }
 
@@ -676,7 +676,7 @@ void *Setpartab(void *argument)
   memset(vars, 0, nvars*sizeof(var_t));
 
   if ( convert_data )
-    for ( varID = 0; varID < nvars; ++varID ) vars[varID].convert = TRUE;
+    for ( varID = 0; varID < nvars; ++varID ) vars[varID].convert = true;
 
   if ( tableformat == 0 )
     {
@@ -714,7 +714,7 @@ void *Setpartab(void *argument)
       for ( int varID = 0; varID < nvars; ++varID )
 	if ( vars[varID].remove )
           {
-            delvars = TRUE;
+            delvars = true;
             break;
           }
 
@@ -797,7 +797,7 @@ void *Setpartab(void *argument)
 	  gridsize = gridInqSize(vlistInqVarGrid(vlistID2, varID2));
 	  if ( vlistInqVarNumber(vlistID2, varID2) != CDI_REAL ) gridsize *= 2;
 
-	  if ( nmiss > 0 && vars[varID].changemissval == TRUE )
+	  if ( nmiss > 0 && vars[varID].changemissval )
 	    {
 	      for ( long i = 0; i < gridsize; ++i )
 		{
@@ -805,7 +805,7 @@ void *Setpartab(void *argument)
 		}
 	    }
 
-	  if ( vars[varID].lfactor == TRUE )
+	  if ( vars[varID].lfactor )
 	    {
 	      for ( long i = 0; i < gridsize; ++i )
 		{
@@ -814,7 +814,7 @@ void *Setpartab(void *argument)
 	    }
 
 #if defined(HAVE_UDUNITS2)
-	  if ( vars[varID].changeunits == TRUE )
+	  if ( vars[varID].changeunits )
 	    {
 	      int nerr = 0;
 	      for ( long i = 0; i < gridsize; ++i )
@@ -829,7 +829,7 @@ void *Setpartab(void *argument)
 		{
 		  cdoWarning("Udunits: Error converting units from [%s] to [%s], parameter: %s",
 			     vars[varID].units_old, vars[varID].units, vars[varID].name);
-		  vars[varID].changeunits = FALSE;
+		  vars[varID].changeunits = false;
 		}
 	    }
 #endif
diff --git a/src/Verifygrid.c b/src/Verifygrid.c
index c9c1dac0732be4de4cae07be1e824499390af3c8..e85be5336e07c2053de152113b226d804ea7b73f 100644
--- a/src/Verifygrid.c
+++ b/src/Verifygrid.c
@@ -309,7 +309,7 @@ bool are_polygon_vertices_arranged_in_clockwise_order(double cell_area)
 }
 
 static
-void verify_grid(int gridsize, int gridno, int ngrids, int ncorner, double *grid_center_lon, double *grid_center_lat, double *grid_corner_lon, double *grid_corner_lat){
+void verify_grid(int gridtype, int gridsize, int gridno, int ngrids, int ncorner, double *grid_center_lon, double *grid_center_lat, double *grid_corner_lon, double *grid_corner_lat){
 
   /* 
      First, this function performs the following test:
@@ -360,11 +360,11 @@ void verify_grid(int gridsize, int gridno, int ngrids, int ncorner, double *grid
   for ( int i = 0; i < ncorner; i++ )
     no_cells_with_a_specific_no_of_corners[i] = 0;
 
-  if ( gridno == 0 )
-    cdoPrint("Grid consists of %d cells, of which", gridsize);
+  if ( ngrids == 1 )
+    cdoPrintBlue("Grid consists of %d cells (type: %s), of which", gridsize, gridNamePtr(gridtype));
   else
-    cdoPrint("Grid no %u (of %u) consists of %d cells, of which", gridno + 1, ngrids, gridsize);
-  cdoPrint("");
+    cdoPrintBlue("Grid no %u (of %u) consists of %d cells (type: %s), of which", gridno + 1, ngrids, gridsize, gridNamePtr(gridtype));
+  //cdoPrint("");
 
   /* For performing the first test, an array of all center point coordinates is built. */
 
@@ -691,17 +691,25 @@ void *Verifygrid(void *argument)
   int ngrids = vlistNgrids(vlistID);
   for ( int gridno = 0; gridno < ngrids; ++gridno )
     {
+      bool lgeo = true;
       bool lgrid_gen_bounds = false, luse_grid_corner = true;
-      double *grid_corner_lat = NULL, *grid_corner_lon = NULL;
 
       int gridID = vlistGrid(vlistID, gridno);
+      int gridtype = gridInqType(gridID);
 
-      if ( gridInqType(gridID) == GRID_GME ) gridID = gridToUnstructured(gridID, 1);
+      if ( gridtype == GRID_GME ) gridID = gridToUnstructured(gridID, 1);
 
-      if ( gridInqType(gridID) != GRID_UNSTRUCTURED && gridInqType(gridID) != GRID_CURVILINEAR )
+      if ( gridtype != GRID_UNSTRUCTURED && gridtype != GRID_CURVILINEAR )
         {
-          gridID = gridToCurvilinear(gridID, 1);
-          lgrid_gen_bounds = TRUE;
+          if ( gridtype == GRID_GENERIC || gridtype == GRID_SPECTRAL )
+            {
+              lgeo = false;
+            }
+          else
+            {
+              gridID = gridToCurvilinear(gridID, 1);
+              lgrid_gen_bounds = true;
+            }
         }
 
       int gridsize = gridInqSize(gridID);
@@ -713,61 +721,71 @@ void *Verifygrid(void *argument)
         Free(grid_mask);
         }
       */
-      int ncorner = 4;
-      if ( gridInqType(gridID) == GRID_UNSTRUCTURED )
-        ncorner = gridInqNvertex(gridID);
+      if ( lgeo )
+        {
+          double *grid_corner_lat = NULL, *grid_corner_lon = NULL;
+          int ncorner = 4;
+          if ( gridInqType(gridID) == GRID_UNSTRUCTURED )
+            ncorner = gridInqNvertex(gridID);
 
-      double *grid_center_lat = (double*) Malloc(gridsize*sizeof(double));
-      double *grid_center_lon = (double*) Malloc(gridsize*sizeof(double));
+          double *grid_center_lat = (double*) Malloc(gridsize*sizeof(double));
+          double *grid_center_lon = (double*) Malloc(gridsize*sizeof(double));
 
-      gridInqYvals(gridID, grid_center_lat);
-      gridInqXvals(gridID, grid_center_lon);
+          gridInqYvals(gridID, grid_center_lat);
+          gridInqXvals(gridID, grid_center_lon);
 
-      /* Convert lat/lon units if required */
-      gridInqXunits(gridID, units);
-      grid_to_degree(units, gridsize, grid_center_lon, "grid center lon");
-      gridInqYunits(gridID, units);
-      grid_to_degree(units, gridsize, grid_center_lat, "grid center lat");
+          /* Convert lat/lon units if required */
+          gridInqXunits(gridID, units);
+          grid_to_degree(units, gridsize, grid_center_lon, "grid center lon");
+          gridInqYunits(gridID, units);
+          grid_to_degree(units, gridsize, grid_center_lat, "grid center lat");
 
-      if ( luse_grid_corner )
-        {
-          if ( ncorner == 0 ) cdoAbort("grid corner missing!");
-          int nalloc = ncorner*gridsize;
-          grid_corner_lat = (double*) Realloc(grid_corner_lat, nalloc*sizeof(double));
-          grid_corner_lon = (double*) Realloc(grid_corner_lon, nalloc*sizeof(double));
-          
-          if ( gridInqYbounds(gridID, NULL) && gridInqXbounds(gridID, NULL) )
-            {
-              gridInqYbounds(gridID, grid_corner_lat);
-              gridInqXbounds(gridID, grid_corner_lon);
-            }
-          else
+          if ( luse_grid_corner )
             {
-              if ( lgrid_gen_bounds )
+              if ( ncorner == 0 ) cdoAbort("grid corner missing!");
+              int nalloc = ncorner*gridsize;
+              grid_corner_lat = (double*) Realloc(grid_corner_lat, nalloc*sizeof(double));
+              grid_corner_lon = (double*) Realloc(grid_corner_lon, nalloc*sizeof(double));
+          
+              if ( gridInqYbounds(gridID, NULL) && gridInqXbounds(gridID, NULL) )
                 {
-                  char xunitstr[CDI_MAX_NAME];
-                  char yunitstr[CDI_MAX_NAME];
-                  gridInqXunits(gridID, xunitstr);
-                  gridInqYunits(gridID, yunitstr);
+                  gridInqYbounds(gridID, grid_corner_lat);
+                  gridInqXbounds(gridID, grid_corner_lon);
                 }
               else
-                cdoAbort("Grid corner missing!");
-            }
-          
-          
-          /* Note: using units from latitude instead from bounds */
-          grid_to_degree(units, ncorner*gridsize, grid_corner_lon, "grid corner lon");
-          grid_to_degree(units, ncorner*gridsize, grid_corner_lat, "grid corner lat");
+                {
+                  if ( lgrid_gen_bounds )
+                    {
+                      char xunitstr[CDI_MAX_NAME];
+                      char yunitstr[CDI_MAX_NAME];
+                      gridInqXunits(gridID, xunitstr);
+                      gridInqYunits(gridID, yunitstr);
+                    }
+                  else
+                    cdoAbort("Grid corner missing!");
+                }
           
-        }
+              /* Note: using units from latitude instead from bounds */
+              grid_to_degree(units, ncorner*gridsize, grid_corner_lon, "grid corner lon");
+              grid_to_degree(units, ncorner*gridsize, grid_corner_lat, "grid corner lat");
+            }
       
-      if ( operatorID == VERIFYGRID )
-        verify_grid(gridsize, gridno, ngrids, ncorner, grid_center_lon, grid_center_lat, grid_corner_lon, grid_corner_lat);
+          if ( operatorID == VERIFYGRID )
+            verify_grid(gridtype, gridsize, gridno, ngrids, ncorner, grid_center_lon, grid_center_lat, grid_corner_lon, grid_corner_lat);
 
-      if ( grid_center_lon ) Free(grid_center_lon);
-      if ( grid_center_lat ) Free(grid_center_lat);
-      if ( grid_corner_lon ) Free(grid_corner_lon);
-      if ( grid_corner_lat ) Free(grid_corner_lat);
+          if ( grid_center_lon ) Free(grid_center_lon);
+          if ( grid_center_lat ) Free(grid_center_lat);
+          if ( grid_corner_lon ) Free(grid_corner_lon);
+          if ( grid_corner_lat ) Free(grid_corner_lat);
+        }
+      else
+        {
+          if ( ngrids == 1 )
+            cdoPrintBlue("Grid consists of %d points (type: %s)", gridsize, gridNamePtr(gridtype));
+          else
+            cdoPrintBlue("Grid no %u (of %u) consists of %d points (type: %s)", gridno + 1, ngrids, gridsize, gridNamePtr(gridtype));
+          cdoPrint("");
+        }
     }
 
   streamClose(streamID);
diff --git a/src/field.h b/src/field.h
index 6c07c28fa2316ae9791c44e38bca56b0082e9b4f..ec30bbb4fa1170e7d69df84354c5160f49243230 100644
--- a/src/field.h
+++ b/src/field.h
@@ -35,7 +35,7 @@ enum field_flag {
 
 #define  MADDMN(x,y)  (DBL_IS_EQUAL((x),missval1) || DBL_IS_EQUAL((y),missval2) ? missval1 : (x)+(y))
 #define  MSUBMN(x,y)  (DBL_IS_EQUAL((x),missval1) || DBL_IS_EQUAL((y),missval2) ? missval1 : (x)-(y))
-#define  MMULMN(x,y)  (DBL_IS_EQUAL((x),missval1) || DBL_IS_EQUAL((y),missval2) ? missval1 : (x)*(y))
+#define  MMULMN(x,y)  (DBL_IS_EQUAL((x),0.)||DBL_IS_EQUAL((y),0.) ? 0 : DBL_IS_EQUAL((x),missval1) || DBL_IS_EQUAL((y),missval2) ? missval1 : (x)*(y))
 #define  MDIVMN(x,y)  (DBL_IS_EQUAL((x),missval1) || DBL_IS_EQUAL((y),missval2) || DBL_IS_EQUAL((y),0.) ? missval1 : (x)/(y))
 #define  MPOWMN(x,y)  (DBL_IS_EQUAL((x),missval1) || DBL_IS_EQUAL((y),missval2) ? missval1 : pow((x),(y)))
 #define  MSQRTMN(x)   (DBL_IS_EQUAL((x),missval1) || (x)<0 ? missval1 : sqrt(x))
@@ -51,7 +51,7 @@ enum field_flag {
 
 #define  ADDM(x,y)  (IS_EQUAL((x),missval1) || IS_EQUAL((y),missval2) ? missval1 : (x)+(y))
 #define  SUBM(x,y)  (IS_EQUAL((x),missval1) || IS_EQUAL((y),missval2) ? missval1 : (x)-(y))
-#define  MULM(x,y)  (IS_EQUAL((x),missval1) || IS_EQUAL((y),missval2) ? missval1 : (x)*(y))
+#define  MULM(x,y)  (IS_EQUAL((x),0.)||IS_EQUAL((y),0.) ? 0 : IS_EQUAL((x),missval1) || IS_EQUAL((y),missval2) ? missval1 : (x)*(y))
 #define  DIVM(x,y)  (IS_EQUAL((x),missval1) || IS_EQUAL((y),missval2) || IS_EQUAL((y),0.) ? missval1 : (x)/(y))
 #define  POWM(x,y)  (IS_EQUAL((x),missval1) || IS_EQUAL((y),missval2) ? missval1 : pow((x),(y)))
 #define  SQRTM(x)   (IS_EQUAL((x),missval1) || (x)<0 ? missval1 : sqrt(x))
diff --git a/src/printinfo.h b/src/printinfo.h
index 3a10ffeb3e90950ada48e81126dc418f3096b84b..a095bb59e27db37966636846eab7495ab5185230 100644
--- a/src/printinfo.h
+++ b/src/printinfo.h
@@ -153,9 +153,10 @@ void printGridInfo(int vlistID)
       int xsize    = gridInqXsize(gridID);
       int ysize    = gridInqYsize(gridID);
       int xysize   = xsize*ysize;
-      int prec     = gridInqPrec(gridID);
+      // int prec     = gridInqPrec(gridID);
 
-      int dig = (prec == DATATYPE_FLT64) ? 15 : 7;
+      // int dig = (prec == DATATYPE_FLT64) ? 15 : 7;
+      int dig = 7;
 
       gridInqXname(gridID, xname);
       gridInqYname(gridID, yname);
diff --git a/src/remapsort.c b/src/remapsort.c
index e3b072e620afaaf3f798b270aee3b83443cce34f..53f6211a19fbeb58500eb82be04ed296fb9140f2 100644
--- a/src/remapsort.c
+++ b/src/remapsort.c
@@ -113,7 +113,7 @@ void remap_heapsort(const long num_links, int *restrict add1, int *restrict add2
 
       /* Loop until proper level is found for this link, or reach bottom */
 
-      for ( i = 0; i < num_links; ++i ) /* while ( TRUE ) */
+      for ( i = 0; i < num_links; ++i )
 	{
 	  /* Find the largest of the two daughters */
 
@@ -190,7 +190,7 @@ void remap_heapsort(const long num_links, int *restrict add1, int *restrict add2
 
       final_lvl = 0;
 
-      for ( i = 0; i < num_links; ++i ) /* while ( TRUE ) */
+      for ( i = 0; i < num_links; ++i )
 	{
 	  /* Find the largest of the two daughters */
 
@@ -352,7 +352,7 @@ void sort_add_orig(long num_links, long num_wts, int *restrict add1, int *restri
 
       /* Loop until proper level is found for this link, or reach bottom */
 
-      for ( i = 0; i < num_links; i++ ) /* while ( TRUE ) */
+      for ( i = 0; i < num_links; i++ )
 	{
 	  /* Find the largest of the two daughters */
 
@@ -435,7 +435,7 @@ void sort_add_orig(long num_links, long num_wts, int *restrict add1, int *restri
 
       final_lvl = 0;
 
-      for ( i = 0; i < num_links; i++ ) /* while ( TRUE ) */
+      for ( i = 0; i < num_links; i++ )
 	{
 	  /* Find the largest of the two daughters */
 
diff --git a/src/util.c b/src/util.c
index 92d94179bd429dd60e2c41250f87e0f39b6892b5..97aacc01649eb3eb45becf98e28d8035ea6ed616 100644
--- a/src/util.c
+++ b/src/util.c
@@ -194,24 +194,23 @@ char *getProgname(char *string)
   if ( progname == NULL ) progname = string;
   else                    progname++;
 
-  return (progname);
+  return progname;
 }
 
 char *getOperator(const char *argument)
 {
   char *operatorArg = NULL;
-  size_t len;
 
   if ( argument )
     {
-      len = 1 + strlen(argument);
+      size_t len = 1 + strlen(argument);
 
       operatorArg = (char*) Malloc(len);
 
       memcpy(operatorArg, argument, len);
     }
 
-  return (operatorArg);
+  return operatorArg;
 }
 
 char *operatorAlias(char *operatorName);
@@ -239,7 +238,7 @@ char *getOperatorName(const char *operatorArg)
       operatorName[len] = '\0';
     }
 
-  /*  return (operatorName); */
+  /*  return operatorName; */
   char * alias = operatorAlias(operatorName);
   return alias;
 }
@@ -247,16 +246,14 @@ char *getOperatorName(const char *operatorArg)
 
 argument_t *file_argument_new(const char *filename)
 {
-  argument_t *argument;
-
-  argument = (argument_t*) Calloc(1, sizeof(argument_t));
+  argument_t *argument = (argument_t*) Calloc(1, sizeof(argument_t));
 
   argument->argc = 1;
   argument->argv = (char **) Calloc(1, sizeof(char *));
   argument->argv[0] = (char *) filename;
   argument->args = (char *) filename;
 
-  return (argument);
+  return argument;
 }
 
 
@@ -276,9 +273,7 @@ void file_argument_free(argument_t *argument)
 
 argument_t *argument_new(size_t argc, size_t len)
 {
-  argument_t *argument;
-
-  argument = (argument_t*) Calloc(1, sizeof(argument_t));
+  argument_t *argument = (argument_t*) Calloc(1, sizeof(argument_t));
 
   if ( argc > 0 )
     {
@@ -289,7 +284,7 @@ argument_t *argument_new(size_t argc, size_t len)
   if ( len > 0 )
     argument->args = (char*) Calloc(len, sizeof(char));
 
-  return (argument);
+  return argument;
 }
 
 
@@ -356,7 +351,7 @@ char *getFileArg(char *argument)
         }
     }
 
-  return (fileArg);
+  return fileArg;
 }
 
 
@@ -396,7 +391,7 @@ double parameter2double(const char *string)
     cdoAbort("Float parameter >%s< contains invalid character at position %d!",
 	     string, (int)(endptr-string+1));
 
-  return (fval);
+  return fval;
 }
 
 
@@ -410,7 +405,7 @@ int parameter2int(const char *string)
     cdoAbort("Integer parameter >%s< contains invalid character at position %d!",
 	     string, (int)(endptr-string+1));
 
-  return (ival);
+  return ival;
 }
 
 
@@ -424,7 +419,7 @@ int parameter2intlist(const char *string)
     cdoAbort("Integer parameter >%s< contains invalid character at position %d!",
 	     string, (int)(endptr-string+1));
 
-  return (ival);
+  return ival;
 }
 
 
@@ -435,11 +430,11 @@ static int season_start = START_DEC;
 
 int get_season_start(void)
 {
-  static int lgetenv = TRUE;
+  static bool lgetenv = true;
 
   if ( lgetenv )
     {
-      lgetenv = FALSE;
+      lgetenv = false;
   
       char *envstr = getenv("CDO_SEASON_START");
       if ( envstr )
@@ -546,13 +541,13 @@ int userFileOverwrite(const char *restrict filename)
 }
 
 
-int ps_lhead = FALSE;
+bool ps_lhead = false;
 int ps_nch   = 0;
 int ps_cval  = -1;
 
 void progressInit(void)
 {
-  ps_lhead = FALSE;
+  ps_lhead = false;
   ps_nch   = 0;
   ps_cval  = -1;
 }
@@ -578,7 +573,7 @@ void progressStatus(double offset, double refval, double curval)
     {
       ps_nch = fprintf(stdout, "%s: %3d%%", processInqPrompt(), 0);
       fflush(stdout);
-      ps_lhead = TRUE;
+      ps_lhead = true;
     }
 
   if ( ival != ps_cval )
@@ -590,7 +585,7 @@ void progressStatus(double offset, double refval, double curval)
 
   if ( ps_cval == 100 && ps_lhead )
     {
-      ps_lhead = FALSE;
+      ps_lhead = false;
       while ( ps_nch-- ) fprintf(stdout, "\b \b");
       fflush(stdout);
     }
@@ -615,7 +610,7 @@ int datatype2str(int datatype, char *datatypestr)
   else if ( datatype == DATATYPE_UINT32 ) strcpy(datatypestr, "U32");
   else                                  { strcpy(datatypestr, "-1"); status = -1;}
 
-  return (status);
+  return status;
 }
 
 
@@ -646,7 +641,7 @@ int str2datatype(const char *datatypestr)
       else if ( strncmp(datatypestr, "double", len) == 0 ) datatype = DATATYPE_FLT64;
     }
 
-  return (datatype);
+  return datatype;
 }
 
 
@@ -677,15 +672,15 @@ const char *filetypeext(int filetype)
   switch ( filetype )
     {
     case FILETYPE_GRB:
-    case FILETYPE_GRB2: return (".grb");   break;
+    case FILETYPE_GRB2: return ".grb";   break;
     case FILETYPE_NC:
     case FILETYPE_NC2:
     case FILETYPE_NC4:
-    case FILETYPE_NC4C: return (".nc");    break;
-    case FILETYPE_SRV:  return (".srv");   break;
-    case FILETYPE_EXT:  return (".ext");   break;
-    case FILETYPE_IEG:  return (".ieg");   break;
-    default:            return ("");
+    case FILETYPE_NC4C: return ".nc";    break;
+    case FILETYPE_SRV:  return ".srv";   break;
+    case FILETYPE_EXT:  return ".ext";   break;
+    case FILETYPE_IEG:  return ".ieg";   break;
+    default:            return "";
     }
 }
 
@@ -736,8 +731,8 @@ void cdoGenFileSuffix(char *filesuffix, size_t maxlen, int filetype, int vlistID
         }
       else
         {
-          int lready = FALSE;
-          int lcompsz = FALSE;
+          bool lready = false;
+          bool lcompsz = false;
           
           if ( filetype == cdoDefaultFileType && cdoDefaultDataType == -1 && cdoDefaultByteorder == -1 )
             {
@@ -753,20 +748,20 @@ void cdoGenFileSuffix(char *filesuffix, size_t maxlen, int filetype, int vlistID
                       switch (firstchar)
                         {
                         case 'g':
-                          if ( cdoDefaultFileType == FILETYPE_GRB || cdoDefaultFileType == FILETYPE_GRB2 ) lready = TRUE;
+                          if ( cdoDefaultFileType == FILETYPE_GRB || cdoDefaultFileType == FILETYPE_GRB2 ) lready = true;
                           break;
                         case 'n':
                           if ( cdoDefaultFileType == FILETYPE_NC || cdoDefaultFileType == FILETYPE_NC2 ||
-                               cdoDefaultFileType == FILETYPE_NC4 || cdoDefaultFileType == FILETYPE_NC4C ) lready = TRUE;
+                               cdoDefaultFileType == FILETYPE_NC4 || cdoDefaultFileType == FILETYPE_NC4C ) lready = true;
                           break;
                         case 's':
-                          if ( cdoDefaultFileType == FILETYPE_SRV ) lready = TRUE;
+                          if ( cdoDefaultFileType == FILETYPE_SRV ) lready = true;
                           break;
                         case 'e':
-                          if ( cdoDefaultFileType == FILETYPE_EXT ) lready = TRUE;
+                          if ( cdoDefaultFileType == FILETYPE_EXT ) lready = true;
                           break;
                         case 'i':
-                          if ( cdoDefaultFileType == FILETYPE_IEG ) lready = TRUE;
+                          if ( cdoDefaultFileType == FILETYPE_IEG ) lready = true;
                           break;
                         }
                     }
@@ -787,10 +782,10 @@ void cdoGenFileSuffix(char *filesuffix, size_t maxlen, int filetype, int vlistID
           if ( !lready )
             {
               strncat(filesuffix, streamFilesuffix(cdoDefaultFileType), maxlen-1);
-              if ( cdoDefaultFileType == FILETYPE_GRB && vlistIsSzipped(vlistID) ) lcompsz = TRUE;
+              if ( cdoDefaultFileType == FILETYPE_GRB && vlistIsSzipped(vlistID) ) lcompsz = true;
             }
 
-          if ( cdoDefaultFileType == FILETYPE_GRB && cdoCompType == COMPRESS_SZIP ) lcompsz = TRUE;
+          if ( cdoDefaultFileType == FILETYPE_GRB && cdoCompType == COMPRESS_SZIP ) lcompsz = true;
           if ( lcompsz ) strncat(filesuffix, ".sz", maxlen-1);
         }
     }
@@ -806,7 +801,7 @@ int cdoFiletype(void)
         cdoPrint("Set default filetype to GRIB");
     }
 
-  return (cdoDefaultFileType);
+  return cdoDefaultFileType;
 }
 
 
diff --git a/src/zaxis.c b/src/zaxis.c
index 84783178f965858f25322765dc3dfc8a151679d3..644d186b3be9bd9753253f78c3d97d1f858f8563 100644
--- a/src/zaxis.c
+++ b/src/zaxis.c
@@ -93,7 +93,7 @@ static int getoptname(char *optname, const char *optstring, int nopt)
   else
     nerr = 1;
 
-  return (nerr);
+  return nerr;
 }
 
 
@@ -135,7 +135,7 @@ int zaxisDefine(zaxis_t zaxis)
 	Warning("vct undefined!");	    
     }
 
-  return (zaxisID);
+  return zaxisID;
 }
 
 
@@ -145,7 +145,7 @@ static char *skipSeparator(char *pline)
   if ( *pline == '=' || *pline == ':' ) pline++;
   while ( isspace((int) *pline) ) pline++;
 
-  return (pline);
+  return pline;
 }
 
 
@@ -153,7 +153,6 @@ int zaxisFromFile(FILE *gfp, const char *dname)
 {
   char line[MAX_LINE_LEN], *pline;
   int zaxisID;
-  int lerror;
   size_t i, len;
   zaxis_t zaxis;
 
@@ -165,11 +164,11 @@ int zaxisFromFile(FILE *gfp, const char *dname)
       if ( line[0] == '\0' ) continue;
       len = strlen(line);
 
-      lerror = FALSE;
+      bool lerror = false;
       for ( i = 0; i < len; ++i )
 	if ( !(line[i] == 9 || (line[i] > 31 && line[i] < 127)) )
 	  {
-	    lerror = TRUE;
+	    lerror = true;
 	    line[i] = '#';
 	  }
       if ( lerror ) cdoAbort("Zaxis description file >%s< contains illegal characters (line: %s)!", dname, line);
@@ -370,7 +369,7 @@ int zaxisFromFile(FILE *gfp, const char *dname)
 
   zaxisID = zaxisDefine(zaxis);
 
-  return (zaxisID);
+  return zaxisID;
 }
 
 
@@ -393,7 +392,7 @@ int zaxisFromName(const char *zaxisname)
 
   if ( zaxis.type != -1 ) zaxisID = zaxisDefine(zaxis);
 
-  return (zaxisID);
+  return zaxisID;
 }
 
 
@@ -417,7 +416,7 @@ int cdoDefineZaxis(const char *zaxisfile)
 
   if ( zaxisID == -1 ) cdoAbort("Invalid zaxis description file %s!", zaxisfile);
 
-  return (zaxisID);
+  return zaxisID;
 }
 
 
@@ -448,7 +447,7 @@ int ztype2ltype(int zaxistype)
   else if ( zaxistype == ZAXIS_ISENTROPIC        )  ltype = 113;
   else if ( zaxistype == ZAXIS_DEPTH_BELOW_SEA   )  ltype = 160;
 
-  return (ltype);
+  return ltype;
 }
 
 
@@ -463,5 +462,5 @@ int zaxis2ltype(int zaxisID)
 
   if ( ltype <= 0 ) ltype = ztype2ltype(zaxistype);
 
-  return (ltype);
+  return ltype;
 }
diff --git a/test/Arith.test.in b/test/Arith.test.in
index 3b2eb88b41d1d60c5c20361279eb3f369f2675a0..67c459830355bd9874de81748c71300df9bd29bb 100644
--- a/test/Arith.test.in
+++ b/test/Arith.test.in
@@ -9,65 +9,59 @@ CDOERR=cerr$$
 FORMAT="-f srv -b 32"
 STATS="add sub mul div"
 #
-IFILE=$DATAPATH/pl_data
 NTEST=1
 #
 for STAT in $STATS; do
   RSTAT=0
 
-  OFILE=stat${STAT}_res
+  RFILE=$DATAPATH/arith${STAT}_ref
 
-  for VAR in -777 -1 0 1 777; do
-    VAL=1
-    CFILE=constval
-    $CDO -f srv -b 64 const,$VAL,$IFILE $CFILE
+  CDOTEST="$STAT"
+  echo "Running test: $NTEST - $CDOTEST"
 
-# stat var const
+# stat vars mask
 
-    CDOTEST="$STAT"
-    CDOCOMMAND="$CDO $FORMAT ${STAT} $IFILE $CFILE $OFILE"
+  IFILE1=$DATAPATH/arith1.srv
+  IFILE2=$DATAPATH/arithmask.srv
+  OFILE=arith${STAT}_res
 
-    echo "Running test: $NTEST - $CDOTEST"
-    echo "$CDOCOMMAND"
+  CDOCOMMAND="$CDO $FORMAT ${STAT} $IFILE1 $IFILE2 $OFILE"
+  echo $CDOCOMMAND
 
-    $CDOCOMMAND
-    test $? -eq 0 || let RSTAT+=1
+  $CDOCOMMAND
+  test $? -eq 0 || let RSTAT+=1
 
-# stat,const var
+  $CDO diff $OFILE $RFILE > $CDOOUT 2> $CDOERR
+  test $? -eq 0 || let RSTAT+=1
+  test -s $CDOOUT && let RSTAT+=1
+  cat $CDOOUT $CDOERR
 
-    OFILE2=stat${STAT}c_res
-    CDOCOMMAND="$CDO $FORMAT ${STAT}c,$VAL $IFILE $OFILE2"
+  rm -f $OFILE
 
-    $CDOCOMMAND
-    test $? -eq 0 || let RSTAT+=1
+# expr,instr var
 
-    $CDO diff $OFILE $OFILE2 > $CDOOUT 2> $CDOERR
-    test $? -eq 0 || let RSTAT+=1
-    test -s $CDOOUT && let RSTAT+=1
-    cat $CDOOUT $CDOERR
+  OP=""
+  if [ "$STAT" = add ] ; then OP='+' ; fi
+  if [ "$STAT" = sub ] ; then OP='-' ; fi
+  if [ "$STAT" = mul ] ; then OP='*' ; fi
+  if [ "$STAT" = div ] ; then OP='/' ; fi
 
-# expr,instr var
+  IFILE=$DATAPATH/expr1.srv
+  OFILE=expr${STAT}_res
+
+  INSTR="var215=var215${OP}var3;var216=var216${OP}var3;"
+  echo $INSTR
+  CDOCOMMAND="$CDO $FORMAT expr,$INSTR $IFILE $OFILE"
+
+  $CDOCOMMAND
+  test $? -eq 0 || let RSTAT+=1
+
+  $CDO diff $OFILE $RFILE > $CDOOUT 2> $CDOERR
+  test $? -eq 0 || let RSTAT+=1
+  test -s $CDOOUT && let RSTAT+=1
+  cat $CDOOUT $CDOERR
 
-    OP=""
-    if [ "$STAT" = add ] ; then OP='+' ; fi
-    if [ "$STAT" = sub ] ; then OP='-' ; fi
-    if [ "$STAT" = mul ] ; then OP='*' ; fi
-    if [ "$STAT" = div ] ; then OP='/' ; fi
-    OFILE3=expr${STAT}_res
-    INSTR="var130=var130${OP}${VAL};var152=var152${OP}${VAL};var129=var129${OP}${VAL};"
-    echo $INSTR
-    CDOCOMMAND="$CDO $FORMAT expr,$INSTR $IFILE $OFILE3"
-
-    $CDOCOMMAND
-    test $? -eq 0 || let RSTAT+=1
-
-    $CDO diff $OFILE $OFILE3 > $CDOOUT 2> $CDOERR
-    test $? -eq 0 || let RSTAT+=1
-    test -s $CDOOUT && let RSTAT+=1
-    cat $CDOOUT $CDOERR
-
-    rm -f $OFILE $OFILE2 $OFILE3 $CFILE
-  done
+  rm -f $OFILE
 
   test $RSTAT -eq 0 && echo "ok $NTEST - $CDOTEST"
   test $RSTAT -eq 0 || echo "not ok $NTEST - $CDOTEST"
diff --git a/test/Arithc.test.in b/test/Arithc.test.in
new file mode 100644
index 0000000000000000000000000000000000000000..3b2eb88b41d1d60c5c20361279eb3f369f2675a0
--- /dev/null
+++ b/test/Arithc.test.in
@@ -0,0 +1,80 @@
+#! @SHELL@
+echo 1..4 # Number of tests to be executed.
+#
+test -n "$CDO"      || CDO=cdo
+test -n "$DATAPATH" || DATAPATH=./data
+#
+CDOOUT=cout$$
+CDOERR=cerr$$
+FORMAT="-f srv -b 32"
+STATS="add sub mul div"
+#
+IFILE=$DATAPATH/pl_data
+NTEST=1
+#
+for STAT in $STATS; do
+  RSTAT=0
+
+  OFILE=stat${STAT}_res
+
+  for VAR in -777 -1 0 1 777; do
+    VAL=1
+    CFILE=constval
+    $CDO -f srv -b 64 const,$VAL,$IFILE $CFILE
+
+# stat var const
+
+    CDOTEST="$STAT"
+    CDOCOMMAND="$CDO $FORMAT ${STAT} $IFILE $CFILE $OFILE"
+
+    echo "Running test: $NTEST - $CDOTEST"
+    echo "$CDOCOMMAND"
+
+    $CDOCOMMAND
+    test $? -eq 0 || let RSTAT+=1
+
+# stat,const var
+
+    OFILE2=stat${STAT}c_res
+    CDOCOMMAND="$CDO $FORMAT ${STAT}c,$VAL $IFILE $OFILE2"
+
+    $CDOCOMMAND
+    test $? -eq 0 || let RSTAT+=1
+
+    $CDO diff $OFILE $OFILE2 > $CDOOUT 2> $CDOERR
+    test $? -eq 0 || let RSTAT+=1
+    test -s $CDOOUT && let RSTAT+=1
+    cat $CDOOUT $CDOERR
+
+# expr,instr var
+
+    OP=""
+    if [ "$STAT" = add ] ; then OP='+' ; fi
+    if [ "$STAT" = sub ] ; then OP='-' ; fi
+    if [ "$STAT" = mul ] ; then OP='*' ; fi
+    if [ "$STAT" = div ] ; then OP='/' ; fi
+    OFILE3=expr${STAT}_res
+    INSTR="var130=var130${OP}${VAL};var152=var152${OP}${VAL};var129=var129${OP}${VAL};"
+    echo $INSTR
+    CDOCOMMAND="$CDO $FORMAT expr,$INSTR $IFILE $OFILE3"
+
+    $CDOCOMMAND
+    test $? -eq 0 || let RSTAT+=1
+
+    $CDO diff $OFILE $OFILE3 > $CDOOUT 2> $CDOERR
+    test $? -eq 0 || let RSTAT+=1
+    test -s $CDOOUT && let RSTAT+=1
+    cat $CDOOUT $CDOERR
+
+    rm -f $OFILE $OFILE2 $OFILE3 $CFILE
+  done
+
+  test $RSTAT -eq 0 && echo "ok $NTEST - $CDOTEST"
+  test $RSTAT -eq 0 || echo "not ok $NTEST - $CDOTEST"
+
+  let NTEST+=1
+done
+#
+rm -f $CDOOUT $CDOERR
+#
+exit 0
diff --git a/test/Makefile.am b/test/Makefile.am
index 839da843ee74ec8be0a02b034e9c79393bbf9875..564e053a6973525edb34c778420a5063383e0b7d 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -13,7 +13,7 @@ TEST_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \
 # tests which should pass
 TESTS = threads.test tsformat.test wildcard.test File.test Read_grib.test Read_netcdf.test Copy_netcdf.test Cat.test Gridarea.test  \
         Detrend.test Genweights.test Remap.test Select.test Spectral.test Ymonstat.test Timstat.test Ensstat.test \
-        Enspctl.test Fldstat.test Fldpctl.test Vertint.test Afterburner.test Arith.test Expr.test \
+        Enspctl.test Fldstat.test Fldpctl.test Vertint.test Afterburner.test Arithc.test Arith.test Expr.test \
         Gradsdes.test Collgrid.test MapReduce.test Ninfo.test
 
 # tests which should fail
diff --git a/test/Makefile.in b/test/Makefile.in
index 9ec7cc1c5562481b8495d0f2e58297ec1a23122d..dafd17f3793c7f14967df473a94b5c2fe868a8ce 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -90,11 +90,11 @@ DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
 	$(srcdir)/Fldstat.test.in $(srcdir)/Fldpctl.test.in \
 	$(srcdir)/Ensstat.test.in $(srcdir)/Enspctl.test.in \
 	$(srcdir)/Afterburner.test.in $(srcdir)/Detrend.test.in \
-	$(srcdir)/Arith.test.in $(srcdir)/Expr.test.in \
-	$(srcdir)/Gradsdes.test.in $(srcdir)/Collgrid.test.in \
-	$(srcdir)/threads.test.in $(srcdir)/tsformat.test.in \
-	$(srcdir)/wildcard.test.in $(srcdir)/MapReduce.test.in \
-	$(srcdir)/Ninfo.test.in README
+	$(srcdir)/Arithc.test.in $(srcdir)/Arith.test.in \
+	$(srcdir)/Expr.test.in $(srcdir)/Gradsdes.test.in \
+	$(srcdir)/Collgrid.test.in $(srcdir)/threads.test.in \
+	$(srcdir)/tsformat.test.in $(srcdir)/wildcard.test.in \
+	$(srcdir)/MapReduce.test.in $(srcdir)/Ninfo.test.in README
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_options.m4 \
 	$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
@@ -109,8 +109,8 @@ CONFIG_CLEAN_FILES = File.test Read_grib.test Read_netcdf.test \
 	Copy_netcdf.test Cat.test Gridarea.test Genweights.test \
 	Remap.test Select.test Spectral.test Timstat.test Vertint.test \
 	Ymonstat.test Fldstat.test Fldpctl.test Ensstat.test \
-	Enspctl.test Afterburner.test Detrend.test Arith.test \
-	Expr.test Gradsdes.test Collgrid.test threads.test \
+	Enspctl.test Afterburner.test Detrend.test Arithc.test \
+	Arith.test Expr.test Gradsdes.test Collgrid.test threads.test \
 	tsformat.test wildcard.test MapReduce.test Ninfo.test
 CONFIG_CLEAN_VPATH_FILES =
 AM_V_P = $(am__v_P_@AM_V@)
@@ -522,7 +522,7 @@ TEST_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \
 # tests which should pass
 TESTS = threads.test tsformat.test wildcard.test File.test Read_grib.test Read_netcdf.test Copy_netcdf.test Cat.test Gridarea.test  \
         Detrend.test Genweights.test Remap.test Select.test Spectral.test Ymonstat.test Timstat.test Ensstat.test \
-        Enspctl.test Fldstat.test Fldpctl.test Vertint.test Afterburner.test Arith.test Expr.test \
+        Enspctl.test Fldstat.test Fldpctl.test Vertint.test Afterburner.test Arithc.test Arith.test Expr.test \
         Gradsdes.test Collgrid.test MapReduce.test Ninfo.test
 
 
@@ -610,6 +610,8 @@ Afterburner.test: $(top_builddir)/config.status $(srcdir)/Afterburner.test.in
 	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
 Detrend.test: $(top_builddir)/config.status $(srcdir)/Detrend.test.in
 	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+Arithc.test: $(top_builddir)/config.status $(srcdir)/Arithc.test.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
 Arith.test: $(top_builddir)/config.status $(srcdir)/Arith.test.in
 	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
 Expr.test: $(top_builddir)/config.status $(srcdir)/Expr.test.in
diff --git a/test/data/Makefile.am b/test/data/Makefile.am
index 143a02efeff9a521417c97b4f345c7ddade29330..fb636f3e1a8453e88be37c923c01e16551385207 100644
--- a/test/data/Makefile.am
+++ b/test/data/Makefile.am
@@ -1,6 +1,6 @@
 INPUTDATA = ts_mm_5years hl_l19.grb t21_geosp_tsurf.grb bathy4.grb pl_data pl_data.grb detrend_data \
             grib_testfile01.grb grib_testfile02.grb grib_testfile03.grb netcdf_testfile01.nc netcdf_testfile02.nc testfile01c.nc \
-            datar.nc datac.nc datau.nc datag.nc
+            datar.nc datac.nc datau.nc datag.nc arith1.srv expr1.srv arithmask.srv
 
 FILE_REF     = file_F32_srv_ref
 GRIB_REF     = grib_testfile01_sinfo_ref grib_testfile01_info_ref grib_testfile02_sinfo_ref grib_testfile02_info_ref grib_testfile03_sinfo_ref grib_testfile03_info_ref
@@ -19,6 +19,7 @@ DETREND_REF  = detrend_ref
 EXPR_REF     = expr1_ref aexpr1_ref expr2_ref aexpr2_ref
 THREAD_REF   = thread1_ref tsformat1_ref
 GRADSDES_REF = pl_data.ctl pl_data.gmp
+ARITH_REF    = arithadd_ref arithsub_ref arithmul_ref arithdiv_ref
 MAPREDUCE    = r18x9_grid icon_cell_grid griddes.r18x9 griddes.icon_cell
 
-EXTRA_DIST = $(INPUTDATA) $(FILE_REF) $(GRIB_REF) $(NETCDF_REF) $(YMONSTAT_REF) $(TIMSTAT_REF) $(FLDSTAT_REF) $(FLDPSTAT_REF) $(ENSPSTAT_REF) $(SPECTRAL_REF) $(VERTINT_REF) $(REMAP_REF) $(SELECT_REF) $(DETREND_REF) $(THREAD_REF) $(EXPR_REF) $(GRADSDES_REF) $(MAPREDUCE)
+EXTRA_DIST = $(INPUTDATA) $(FILE_REF) $(GRIB_REF) $(NETCDF_REF) $(YMONSTAT_REF) $(TIMSTAT_REF) $(FLDSTAT_REF) $(FLDPSTAT_REF) $(ENSPSTAT_REF) $(SPECTRAL_REF) $(VERTINT_REF) $(REMAP_REF) $(SELECT_REF) $(DETREND_REF) $(THREAD_REF) $(EXPR_REF) $(GRADSDES_REF) $(ARITH_REF) $(MAPREDUCE)
diff --git a/test/data/Makefile.in b/test/data/Makefile.in
index 03c52d0d870f5024a10ef8f78276e458f333e4bd..e974fb91ecd9015a6751072bea4e8bea81a54ef8 100644
--- a/test/data/Makefile.in
+++ b/test/data/Makefile.in
@@ -287,7 +287,7 @@ top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 INPUTDATA = ts_mm_5years hl_l19.grb t21_geosp_tsurf.grb bathy4.grb pl_data pl_data.grb detrend_data \
             grib_testfile01.grb grib_testfile02.grb grib_testfile03.grb netcdf_testfile01.nc netcdf_testfile02.nc testfile01c.nc \
-            datar.nc datac.nc datau.nc datag.nc
+            datar.nc datac.nc datau.nc datag.nc arith1.srv expr1.srv arithmask.srv
 
 FILE_REF = file_F32_srv_ref
 GRIB_REF = grib_testfile01_sinfo_ref grib_testfile01_info_ref grib_testfile02_sinfo_ref grib_testfile02_info_ref grib_testfile03_sinfo_ref grib_testfile03_info_ref
@@ -307,8 +307,9 @@ DETREND_REF = detrend_ref
 EXPR_REF = expr1_ref aexpr1_ref expr2_ref aexpr2_ref
 THREAD_REF = thread1_ref tsformat1_ref
 GRADSDES_REF = pl_data.ctl pl_data.gmp
+ARITH_REF = arithadd_ref arithsub_ref arithmul_ref arithdiv_ref
 MAPREDUCE = r18x9_grid icon_cell_grid griddes.r18x9 griddes.icon_cell
-EXTRA_DIST = $(INPUTDATA) $(FILE_REF) $(GRIB_REF) $(NETCDF_REF) $(YMONSTAT_REF) $(TIMSTAT_REF) $(FLDSTAT_REF) $(FLDPSTAT_REF) $(ENSPSTAT_REF) $(SPECTRAL_REF) $(VERTINT_REF) $(REMAP_REF) $(SELECT_REF) $(DETREND_REF) $(THREAD_REF) $(EXPR_REF) $(GRADSDES_REF) $(MAPREDUCE)
+EXTRA_DIST = $(INPUTDATA) $(FILE_REF) $(GRIB_REF) $(NETCDF_REF) $(YMONSTAT_REF) $(TIMSTAT_REF) $(FLDSTAT_REF) $(FLDPSTAT_REF) $(ENSPSTAT_REF) $(SPECTRAL_REF) $(VERTINT_REF) $(REMAP_REF) $(SELECT_REF) $(DETREND_REF) $(THREAD_REF) $(EXPR_REF) $(GRADSDES_REF) $(ARITH_REF) $(MAPREDUCE)
 all: all-am
 
 .SUFFIXES:
diff --git a/test/data/arith1.srv b/test/data/arith1.srv
new file mode 100644
index 0000000000000000000000000000000000000000..67db42e31b34d64660735bde84c2981ef23aaa28
Binary files /dev/null and b/test/data/arith1.srv differ
diff --git a/test/data/arithadd_ref b/test/data/arithadd_ref
new file mode 100644
index 0000000000000000000000000000000000000000..53d7363adddb11424252a98a5da048fca05003f7
Binary files /dev/null and b/test/data/arithadd_ref differ
diff --git a/test/data/arithdiv_ref b/test/data/arithdiv_ref
new file mode 100644
index 0000000000000000000000000000000000000000..8afac802d72b2153080dc85412395283093f4d4e
Binary files /dev/null and b/test/data/arithdiv_ref differ
diff --git a/test/data/arithmask.srv b/test/data/arithmask.srv
new file mode 100644
index 0000000000000000000000000000000000000000..2b51fcaf7bc79d2fea4c11671a28e37e45abd245
Binary files /dev/null and b/test/data/arithmask.srv differ
diff --git a/test/data/arithmul_ref b/test/data/arithmul_ref
new file mode 100644
index 0000000000000000000000000000000000000000..152b2ca39ebe48e20146d9c01fec5002c4e9f468
Binary files /dev/null and b/test/data/arithmul_ref differ
diff --git a/test/data/arithsub_ref b/test/data/arithsub_ref
new file mode 100644
index 0000000000000000000000000000000000000000..8304f4db41bdd9af11b89938b6bbf81e761562fa
Binary files /dev/null and b/test/data/arithsub_ref differ
diff --git a/test/data/expr1.srv b/test/data/expr1.srv
new file mode 100644
index 0000000000000000000000000000000000000000..a119f6736ab7c8a71459154bfd8378aa83a94e9c
Binary files /dev/null and b/test/data/expr1.srv differ
diff --git a/test/data/gen_refdata.sh b/test/data/gen_refdata.sh
index e19d3d3674cce8044a15360d2e9d8ac942a0eb16..0b93d3cbca9ba21d879299101a1dc2debb7582a3 100755
--- a/test/data/gen_refdata.sh
+++ b/test/data/gen_refdata.sh
@@ -6,6 +6,17 @@ FORMAT="-f srv -b F32"
 #
 ########################################################################
 #
+# Arith
+#
+IFILE=arith1.srv
+MASK=arithmask.srv
+OPS="add sub mul div"
+for OP in $OPS; do
+  $CDO $FORMAT $OP $IFILE $MASK arith${OP}_ref
+done
+exit
+########################################################################
+#
 # Fldpctl
 #
 IFILE=t21_geosp_tsurf.grb