diff --git a/patches/applyPatches.sh b/patches/applyPatches.sh
index a0c8e045e8cb31bff64cb458a091e89a59be80cc..46369e497d3e1e0b93966bfa0aed6d36b2b94d58 100755
--- a/patches/applyPatches.sh
+++ b/patches/applyPatches.sh
@@ -6,6 +6,7 @@
 # Copyright (C) 2018 Research Group Biomedical Physics,
 # Max-Planck-Institute for Dynamics and Self-Organization Göttingen
 # Copyright (C) 2020 Timm Fitschen <t.fitschen@indiscale.com>
+# Copyright (C) 2020 Daniel Hornung <d.hornung@indiscale.com>
 # Copyright (C) 2020 IndiScale <info@indiscale.com>
 #
 # This program is free software: you can redistribute it and/or modify
@@ -33,8 +34,6 @@ set -e
 if [ -z "$UTILSPATH" ]; then
     UTILSPATH=$(realpath "$(dirname $0)/../utils")
     export UTILSPATH
-	MAINPATH="$(dirname $UTILSPATH)"
-	export MAINPATH
 fi
 
 source $UTILSPATH/load_settings.sh
diff --git a/utils/backup.sh b/utils/backup.sh
index aab15415b1490c53cef7809cdb7366fa871b62b3..29422d8f1ba5094c26ae9953e5b1e27b72fd65d5 100755
--- a/utils/backup.sh
+++ b/utils/backup.sh
@@ -5,6 +5,8 @@
 #
 # Copyright (C) 2018 Research Group Biomedical Physics,
 # Max-Planck-Institute for Dynamics and Self-Organization Göttingen
+# Copyright (C) 2020 Daniel Hornung <d.hornung@indiscale.com>
+# Copyright (C) 2020 IndiScale <info@indiscale.com>
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU Affero General Public License as
@@ -27,8 +29,6 @@
 if [ -z "$UTILSPATH" ]; then
 	UTILSPATH="$(realpath $(dirname $0))"
 	export UTILSPATH
-	MAINPATH="$(dirname $UTILSPATH)"
-	export MAINPATH
 fi
 
 # The directory which the dump is to be stored to. Do not change it here. Use
@@ -45,14 +45,30 @@ function backup() {
     database="$1"
     backupdir="$2"
 
+<<<<<<< HEAD
     # Assert backup dir
     mkdir -p "$backupdir"
     datastring=$(date -u --rfc-3339=ns | sed 's/ /T/g')
     backupfile=${BACKUPDIR}/${DATABASE_NAME}.${datastring}.dump.sql
+=======
+    shift 2
+    # parameters: connection, database, outfile
+    if [ -e "$NARG_FILE" ]; then
+        failure "dumpfile already exists."
+    fi
+    echo "Dumping database $NARG_NAME to $NARG_FILE ... "
+  $MYSQLDUMP_CMD $(get_mysql_args_nodb) $* --opt --default-character-set=utf8 --routines \
+                    "$NARG_NAME" > "$NARG_FILE"
+>>>>>>> s-clean-up-stage
 
     if [ -e "$backupfile" ]; then
         failure "dumpfile already exists."
     fi
+<<<<<<< HEAD
+=======
+    success
+}
+>>>>>>> s-clean-up-stage
 
     echo "Dumping database $database to $backupfile ... "
     $MYSQLDUMP_CMD $(get_mysql_args_nodb) --opt --default-character-set=utf8\
diff --git a/utils/helpers.sh b/utils/helpers.sh
index 4ecf8789b650d9463639b119dcda1bfe2bce2bcd..cec709d4f8705357110ab308c3c9658293f0c494 100644
--- a/utils/helpers.sh
+++ b/utils/helpers.sh
@@ -2,8 +2,9 @@
 #
 # Copyright (C) 2018 Research Group Biomedical Physics,
 # Max-Planck-Institute for Dynamics and Self-Organization Göttingen
-# Copyright 2019, 2020 Daniel Hornung
-# Copyright 2020 Henrik tom Wörden, IndiScale GmbH
+# Copyright (C) 2019, 2020 Daniel Hornung (d.hornung@indiscale.com)
+# Copyright (C) 2020 Henrik tom Wörden
+# Copyright (C) 2020 IndiScale GmbH <info@indiscale.com>
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU Affero General Public License as
@@ -32,14 +33,12 @@
 
 function mysql_execute {
 	  #TODO is it meaningful that here always the database user is used???
-	  set +e
-    # env | sort
+	  set -e
 	  $MYSQL_CMD $(get_db_args) -e "$1"
 	  ret=${PIPESTATUS[0]}
 	  if [ "$ret" -ne 0 ]; then
 		    failure "MYSQL ERROR"
 	  fi
-	  set -e
 }
 
 function get_mysql_args {
diff --git a/utils/load_settings.sh b/utils/load_settings.sh
index a46db58d2c4c3d1e4a87d1f2b831f77bc6163b1b..73d63364dd582dbc514ac3c2d95a37346b5b0eed 100644
--- a/utils/load_settings.sh
+++ b/utils/load_settings.sh
@@ -1,9 +1,10 @@
 # This file is a part of the CaosDB Project.
 #
 # Copyright (C) 2018 Research Group Biomedical Physics,
-# Max-Planck-Institute for Dynamics and Self-Organization Göttingen
-# Copyright 2019 Daniel Hornung
-# Copyright 2020 Henrik tom Wörden, IndiScale GmbH
+#   Max-Planck-Institute for Dynamics and Self-Organization Göttingen
+# Copyright (C) 2019, 2020 Daniel Hornung (d.hornung@indiscale.com)
+# Copyright (C) 2020 Henrik tom Wörden
+# Copyright (C) 2020 IndiScale GmbH <info@indiscale.com>
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU Affero General Public License as
@@ -23,29 +24,34 @@
 # - .config (in the current directory)
 # - The file given in ENV_FILE.
 
-if [ "$MAINPATH" ]; then
-    pushd "$MAINPATH" > /dev/null
-    pushed=1
+if [ -z "$MAINPATH" ]; then
+    if [ -z "$UTILSPATH" ] ; then
+        echo "At least one of MAINPATH and UTILSPATH must be defined in load_settings.sh" >&2
+        exit 1
+    fi
+    MAINPATH="$(dirname $UTILSPATH)"
+    export MAINPATH
 fi
 
-if [[ -r "config.defaults" ]] ; then
-    source "config.defaults"
-fi
-if [[ -r ".config" ]] ; then
-    source ".config"
+# Make a backup of the important environment variables.
+my_env=$(export -p | grep -E '(MYSQL|DATABASE)')
+
+source "$MAINPATH/config.defaults"
+
+if [[ -r "$MAINPATH/.config" ]] ; then
+    source "$MAINPATH/.config"
 fi
 if [[ -n "$ENV_FILE" ]] ; then
     source "$ENV_FILE"
 fi
 
 if [[ -z "$MYSQL_CMD" ]] ; then
-    echo "mysql not defined!"
+    echo "'mysql' executable not defined!"
     exit 1
 fi
 
-if [ $pushed ]; then
-    popd > /dev/null
-fi
+# Restore backup.
+eval "$my_env"
 
 export MYSQL_CMD
 export MYSQLDUMP_CMD
diff --git a/utils/make_db b/utils/make_db
index 92a8541c73d55b9a2c5d779926afb27b2ed2415d..323a116f230a142b0ba0db21b41ef3fe3b96a42c 100755
--- a/utils/make_db
+++ b/utils/make_db
@@ -3,8 +3,9 @@
 # ** header v3.0
 # This file is a part of the CaosDB Project.
 #
-# Copyright (C) 2019 Daniel Hornung, Göttingen
+# Copyright (C) 2019, 2020 Daniel Hornung <d.hornung@indiscale.com>
 # Copyright (C) 2020 Timm Fitschen <t.fitschen@indiscale.com>
+# Copyright (C) 2020 Henrik tom Wörden <h.tomwoerden@indiscale.com>
 # Copyright (C) 2020 IndiScale <info@indiscale.com>
 #
 # This program is free software: you can redistribute it and/or modify
@@ -27,20 +28,13 @@ set -e
 INSTALL_SQL_FILE="db_2_0.sql"
 
 if [ -z "$UTILSPATH" ]; then
-	UTILSPATH="$(realpath $(dirname $0))"
-	export UTILSPATH
-	MAINPATH="$(dirname $UTILSPATH)"
-	export MAINPATH
+    UTILSPATH="$(realpath $(dirname $0))"
+    export UTILSPATH
 fi
 
 source $UTILSPATH/load_settings.sh
 source $UTILSPATH/helpers.sh
 
-function fail() {
-  echo "Some error occured, exiting."
-  exit 1
-}
-
 UNITTEST_DATABASE=${UNITTEST_DATABASE-_caosdb_schema_unit_tests}
 
 # optional parameter: [--fresh] for installing a fresh data base. Otherwise an existing one would be reused.
@@ -50,7 +44,7 @@ function runtests() {
 
     _install_unit_test_database $@
 
-    _execute_tests || ( echo "[FAILURE]" && exit 1 )
+    _execute_tests || ( failure )
     echo "[PASS]"
 }
 
@@ -103,7 +97,7 @@ function _setup_mytap() {
         echo MyTAB framework is already installed [OK]
         return 0
     fi
-    echo -n "Installing MyTAB framework ... "
+    echo -n "Installing MyTAP framework ... "
     pushd libs > /dev/null
     unzip -u mytap*.zip > /dev/null
     pushd mytap*/ > /dev/null
@@ -111,7 +105,7 @@ function _setup_mytap() {
     popd > /dev/null
     rm -r mytap*/
     popd > /dev/null
-    echo [DONE]
+    echo "[DONE]"
 }
 
 function install_db() {
@@ -123,7 +117,7 @@ Call 'make drop-$DATABASE_NAME' to delete that database or reconfigure with
         exit 0
     fi
 
-	  sed "s/db_2_0/$DATABASE_NAME/g" "$INSTALL_SQL_FILE" | $MYSQL_CMD $(get_mysql_args_nodb)
+    sed "s/db_2_0/$DATABASE_NAME/g" "$INSTALL_SQL_FILE" | $MYSQL_CMD $(get_mysql_args_nodb)
 }
 
 # Inserts the dump (arg 1) into the database
@@ -144,7 +138,7 @@ function grant() {
         while true; do
             read -p "Please enter the password for ${DATABASE_USER}: " \
                  -s password
-            echo                
+            echo
             read -p "Please repeat the password: " -s password2
             echo
             [[ "$password" == "$password2" ]] && {
@@ -158,7 +152,7 @@ function grant() {
     if [[ "$1" == "--strict" ]] ; then
         for host in ${DATABASE_USER_HOST_LIST//,/ } ; do
             CMD="SELECT COUNT(*) FROM mysql.user WHERE user='${DATABASE_USER}' AND host='${host}';"
-		        [[ $($MYSQL_CMD $(get_mysql_args_nodb) -s -N -e "$CMD") == 0 ]] || {
+            [[ $($MYSQL_CMD $(get_mysql_args_nodb) -s -N -e "$CMD") == 0 ]] || {
                 echo "The user '${DATABASE_USER}@${host}' is already in the database."
                 echo "Please use another user or delete it, e.g. with"
                 echo "'mysql -u ${MYSQL_USER} -p -e \"DROP USER ${DATABASE_USER}@${host};\"'"
@@ -199,12 +193,12 @@ function _db_exists() {
 
 
 case $1 in
-  "drop") drop $2 ;;
-  "grant") grant $2 ;;
-  "test") shift ; runtests $@ ;;
-  "test-connection") test-connection ;;
-  "install_db") install_db ;;
-  "restore_db") restore_db $2 ;;
-  # "prep_sql") prepare_sql ;;
-  *) echo "Unknown action: $1"
+    "drop") drop $2 ;;
+    "grant") grant $2 ;;
+    "test") shift ; runtests $@ ;;
+    "test-connection") test-connection ;;
+    "install_db") install_db ;;
+    "restore_db") restore_db $2 ;;
+    # "prep_sql") prepare_sql ;;
+    *) echo "Unknown action: $1"
 esac
diff --git a/utils/patch_header.sh b/utils/patch_header.sh
index f53266aabd96b316ecf2c17948384c505e5a9d87..488b7a0f4df0c20bde1909872d923ea4c352cacc 100644
--- a/utils/patch_header.sh
+++ b/utils/patch_header.sh
@@ -4,7 +4,9 @@
 #
 # Copyright (C) 2018 Research Group Biomedical Physics,
 # Max-Planck-Institute for Dynamics and Self-Organization Göttingen
-# Copyright 2019 Daniel Hornung
+# Copyright (C) 2019, 2020 Daniel Hornung <d.hornung@indiscale.com>
+# Copyright (C) 2020 Henrik tom Wörden <h.tomwoerden@indiscale.com>
+# Copyright (C) 2020 IndiScale <info@indiscale.com>
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU Affero General Public License as
@@ -21,7 +23,12 @@
 #
 # ** end header
 #
-#header for patch scripts
+
+###############################################################################
+#                          header for patch scripts                           #
+###############################################################################
+
+set -e
 
 # load useful functions #######################################################
 source $UTILSPATH/load_settings.sh
@@ -57,7 +64,6 @@ configuration make file.  Notable examples are:
 
 EOF
               )
-set -e
 
 function _print_help() {
   echo -e "$USAGE"
diff --git a/utils/update_sql_procedures.sh b/utils/update_sql_procedures.sh
index 2b78ab8cca5b1d337fa03d9ab3bb2e2e120a3be0..8850d5c3311c4ee1a6c7cd635bb1b1bb98fe218c 100755
--- a/utils/update_sql_procedures.sh
+++ b/utils/update_sql_procedures.sh
@@ -4,7 +4,10 @@
 # This file is a part of the CaosDB Project.
 #
 # Copyright (C) 2018 Research Group Biomedical Physics,
-# Max-Planck-Institute for Dynamics and Self-Organization Göttingen
+#   Max-Planck-Institute for Dynamics and Self-Organization Göttingen
+# Copyright (C) 2020 Daniel Hornung <d.hornung@indiscale.com>
+# Copyright (C) 2020 Henrik tom Wörden <h.tomwoerden@indiscale.com>
+# Copyright (C) 2020 IndiScale <info@indiscale.com>
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU Affero General Public License as
@@ -24,24 +27,21 @@
 
 # Updates all SQL procedures
 
+set -e
+
 if [ -z "$UTILSPATH" ]; then
     UTILSPATH=$(realpath "$(dirname $0)")
     export UTILSPATH
-	MAINPATH="$(dirname $UTILSPATH)"
-	export MAINPATH
 fi
 
-source $UTILSPATH/helpers.sh
 source $UTILSPATH/load_settings.sh
+source $UTILSPATH/helpers.sh
 
 echo -n "updating rules ... "
-set -e
 
 mysql_execute "$(sed s/db_2_0/$DATABASE_NAME/g rules.sql)"
 echo "OK"
 
 echo -n "updating procedures ... "
-mysql_execute "$(sed s/db_2_0/$DATABASE_NAME/g procedures/*.sql procedures/query/*.sql)" 
+mysql_execute "$(sed s/db_2_0/$DATABASE_NAME/g procedures/*.sql procedures/query/*.sql)"
 echo "OK"
-
-