diff --git a/public_html/appmonitor/classes/appmonitor-checks.class.php b/public_html/appmonitor/classes/appmonitor-checks.class.php
index a31e07f8c81b3c7b4880e50dfce8228c6bb550a6..66d2375eb012e75c0a6631722b53cb30d61585f3 100644
--- a/public_html/appmonitor/classes/appmonitor-checks.class.php
+++ b/public_html/appmonitor/classes/appmonitor-checks.class.php
@@ -1,12 +1,28 @@
 <?php
 
-define("RESULT_OK", 0);
-define("RESULT_UNKNOWN", 1);
-define("RESULT_WARNING", 2);
-define("RESULT_ERROR", 3);
+if(!defined('RESULT_OK')){
+    define("RESULT_OK", 0);
+    define("RESULT_UNKNOWN", 1);
+    define("RESULT_WARNING", 2);
+    define("RESULT_ERROR", 3);
+}
 
 /**
- * APPMONITOR CLIENT CHECKS<br>
+ * ____________________________________________________________________________
+ * 
+ *  _____ _____ __                   _____         _ _           
+ * |     |     |  |      ___ ___ ___|     |___ ___|_| |_ ___ ___ 
+ * |-   -| | | |  |__   | .'| . | . | | | | . |   | |  _| . |  _|
+ * |_____|_|_|_|_____|  |__,|  _|  _|_|_|_|___|_|_|_|_| |___|_|  
+ *                          |_| |_|                              
+ *                           _ _         _                                            
+ *                       ___| |_|___ ___| |_                                          
+ *                      |  _| | | -_|   |  _|                                         
+ *                      |___|_|_|___|_|_|_|   
+ *                                                               
+ * ____________________________________________________________________________
+ * 
+ * APPMONITOR :: CLASS FOR CLIENT TEST FUNCTIONS<br>
  * <br>
  * THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE <br>
  * LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR <br>
diff --git a/public_html/appmonitor/classes/appmonitor-client.class.php b/public_html/appmonitor/classes/appmonitor-client.class.php
index 297174ce14baba39e4ad26892d463d94f309de96..a73a52a314be44f689a3dafd0f07940bc698fc7c 100644
--- a/public_html/appmonitor/classes/appmonitor-client.class.php
+++ b/public_html/appmonitor/classes/appmonitor-client.class.php
@@ -1,7 +1,21 @@
 <?php
 
 /**
- * APPMONITOR CLIENT<br>
+ * ____________________________________________________________________________
+ * 
+ *  _____ _____ __                   _____         _ _           
+ * |     |     |  |      ___ ___ ___|     |___ ___|_| |_ ___ ___ 
+ * |-   -| | | |  |__   | .'| . | . | | | | . |   | |  _| . |  _|
+ * |_____|_|_|_|_____|  |__,|  _|  _|_|_|_|___|_|_|_|_| |___|_|  
+ *                          |_| |_|                              
+ *                           _ _         _                                            
+ *                       ___| |_|___ ___| |_                                          
+ *                      |  _| | | -_|   |  _|                                         
+ *                      |___|_|_|___|_|_|_|   
+ *                                                               
+ * ____________________________________________________________________________
+ * 
+ * APPMONITOR :: CLASS FOR CLIENT CHECKS<br>
  * <br>
  * THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE <br>
  * LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR <br>
@@ -22,7 +36,7 @@
  * 2018-08-27  0.52  axel.hahn@iml.unibe.ch  add pdo connect (starting with mysql)<br>
  * 2018-11-05  0.58  axel.hahn@iml.unibe.ch  additional flag in http check to show content<br>
  * --------------------------------------------------------------------------------<br>
- * @version 0.77
+ * @version 0.85
  * @author Axel Hahn
  * @link TODO
  * @license GPL
@@ -36,7 +50,7 @@ class appmonitor {
      * value is in seconds
      * @var int
      */
-    protected $_sVersion = 'php-client-v0.77';
+    protected $_sVersion = 'php-client-v0.85';
 
     /**
      * config: default ttl for server before requesting the client check again
@@ -65,8 +79,12 @@ class appmonitor {
      */
     protected $_aChecks = array();
     
+    /**
+     * for time measurements: start time
+     * @var type 
+     */
     protected $_iStart = false;
-
+    
     /**
      * constructor: init data
      */
@@ -175,9 +193,16 @@ class appmonitor {
         $oCheck = new appmonitorcheck();
         // print_r($aJob); die();
         $aCheck = $oCheck->makecheck($aJob);
+        
+        // limit error code
+        // echo "DEBUG ".$aCheck["name"].": ".$aCheck["result"]."\n";
+        $iMyResult=isset($aJob['worstresult']) 
+                ? min($aCheck["result"], $aJob['worstresult'])
+                : $aCheck["result"]
+                ;
 
-        if (!$this->_iMaxResult || $aCheck["result"] > $this->_iMaxResult) {
-            $this->_iMaxResult = $aCheck["result"];
+        if (!$this->_iMaxResult || $iMyResult > $this->_iMaxResult) {
+            $this->_iMaxResult = $iMyResult;
         }
         return $this->_aChecks[] = $aCheck;
     }
@@ -317,19 +342,28 @@ class appmonitor {
             $aErrors[] = "method setResult was not used to set a final result for all checks.";
         }
 
-
         if (count($aErrors)) {
-            header('HTTP/1.0 503 Service Unavailable');
-            echo "<h1>Errors detected</h1><ol><li>" . implode("<li>", $aErrors) . "</ol><hr>";
-            echo "<pre>" . print_r($this->getResults(), true) . "</pre><hr>";
-            die("ABORT");
+            $this->abort(
+                '<h2>Error: client check is not complete</h2><p>Found errors:</p><ol><li>' . implode('<li>', $aErrors) . '</ol><br><br>'
+                // .'Dump of your data so far:<pre>' . json_encode($this->getResults(), JSON_PRETTY_PRINT) . '</pre><hr>'
+            );
         }
+        return true;
     }
 
     // ----------------------------------------------------------------------
     // output
     // ----------------------------------------------------------------------
 
+    /**
+     * stop processing the client checks and abort with an error
+     * @param string $sMessage
+     */
+    public function abort($sMessage){
+        header('HTTP/1.0 503 Service Unavailable');
+        die('<h1>503 Service Unavailable</h1>'.$sMessage);
+    }
+    
     /**
      * get full array for response with metadata and Checks
      * @return type