diff --git a/src/app/resource/controllers/IndexingController.php b/src/app/resource/controllers/IndexingController.php
index e67a60c93cf6d4190bbaa7a9231d7e3e97051345..dddc48e349dd76eb42ec98e527317caf593e1c43 100755
--- a/src/app/resource/controllers/IndexingController.php
+++ b/src/app/resource/controllers/IndexingController.php
@@ -233,15 +233,21 @@ class IndexingController
 
         if (!empty($queryParams['doctype'])) {
             $doctype = DoctypeModel::getById(['id' => $queryParams['doctype'], 'select' => ['process_delay']]);
-            $delay   = $doctype['process_delay'];
+            if (empty($doctype)) {
+                return $response->withStatus(400)->withJson(['errors' => 'Doctype does not exists']);
+            }
+            $delay = $doctype['process_delay'];
         } elseif (!empty($queryParams['priority'])) {
             $priority = PriorityModel::getById(['id' => $queryParams['priority'], 'select' => ['delays']]);
-            $delay    = $priority['delays'];
+            if (empty($priority)) {
+                return $response->withStatus(400)->withJson(['errors' => 'Priority does not exists']);
+            }
+            $delay = $priority['delays'];
         }
         if ($delay == 0) {
             return $response->withJson(['processLimitDate' => null]);
         }
-        if (!isset($delay) || !Validator::intVal()->validate($delay)) {
+        if (!Validator::intVal()->validate($delay)) {
             return $response->withStatus(400)->withJson(['errors' => 'Delay is not a numeric value']);
         }
 
diff --git a/src/app/user/controllers/UserController.php b/src/app/user/controllers/UserController.php
index 79e82e36dd008509084e8baab9e5eff641f8bbb0..c9dc1803b240101286fa9bd61994cafeda841f89 100755
--- a/src/app/user/controllers/UserController.php
+++ b/src/app/user/controllers/UserController.php
@@ -171,7 +171,7 @@ class UserController
         $check = $check && Validator::stringType()->length(1, 255)->notEmpty()->validate($data['lastname']);
         $check = $check && Validator::stringType()->length(0, 32)->validate($data['initials'] ?? '');
         $check = $check && Validator::stringType()->length(1, 255)->notEmpty()->validate($data['mail']);
-        $check = $check && (empty($data['mail']) || filter_var($data['mail'], FILTER_VALIDATE_EMAIL));
+        $check = $check && filter_var($data['mail'], FILTER_VALIDATE_EMAIL);
         if (PrivilegeController::hasPrivilege(['privilegeId' => 'manage_personal_data', 'userId' => $GLOBALS['id']])) {
             $check = $check && (empty($data['phone']) || preg_match("/\+?((|\ |\.|\(|\)|\-)?(\d)*)*\d$/", $data['phone'])) && Validator::stringType()->length(0, 32)->validate($data['phone'] ?? '');
         }
diff --git a/test/unitTests/app/indexing/IndexingControllerTest.php b/test/unitTests/app/indexing/IndexingControllerTest.php
index 867034b972a696fb6c4aae5868d3d7520751c749..27aec4987cb8a026962bc7896fb6c45a16721ef7 100755
--- a/test/unitTests/app/indexing/IndexingControllerTest.php
+++ b/test/unitTests/app/indexing/IndexingControllerTest.php
@@ -155,7 +155,7 @@ class IndexingControllerTest extends TestCase
         $response     = $indexingController->getProcessLimitDate($fullRequest, new \Slim\Http\Response());
 
         $responseBody = json_decode((string)$response->getBody());
-        $this->assertSame('Delay is not a numeric value', $responseBody->errors);
+        $this->assertSame('Priority does not exists', $responseBody->errors);
 
         $GLOBALS['login'] = 'superadmin';
         $userInfo = \User\models\UserModel::getByLogin(['login' => $GLOBALS['login'], 'select' => ['id']]);
diff --git a/test/unitTests/app/user/UserControllerTest.php b/test/unitTests/app/user/UserControllerTest.php
index 9a71fb2f0f85e5454bbeb5c6d853da7298564d5e..11ead1aefdec5a32a59044b022b51775f5ec7fcb 100755
--- a/test/unitTests/app/user/UserControllerTest.php
+++ b/test/unitTests/app/user/UserControllerTest.php
@@ -103,7 +103,8 @@ class UserControllerTest extends TestCase
         $aArgs = [
             'userId'    => 'test-ckent',
             'firstname' => 'TEST-CLARK',
-            'lastname'  => 'TEST-KENT'
+            'lastname'  => 'TEST-KENT',
+            'mail'      => 'clark@test.zh'
         ];
         $fullRequest = \httpRequestCustom::addContentInBody($aArgs, $request);
 
@@ -126,7 +127,7 @@ class UserControllerTest extends TestCase
         $this->assertSame('TEST-KENT', $responseBody->lastname);
         $this->assertSame('OK', $responseBody->status);
         $this->assertSame(null, $responseBody->phone);
-        $this->assertSame(null, $responseBody->mail);
+        $this->assertSame('clark@test.zh', $responseBody->mail);
         $this->assertSame(null, $responseBody->initials);
 
         // Delete user then reactivate it
@@ -142,7 +143,8 @@ class UserControllerTest extends TestCase
         $aArgs = [
             'userId'    => 'test-ckent',
             'firstname' => 'TEST-CLARK',
-            'lastname'  => 'TEST-KENT'
+            'lastname'  => 'TEST-KENT',
+            'mail'      => 'clark@test.zh'
         ];
         $fullRequest = \httpRequestCustom::addContentInBody($aArgs, $request);
 
@@ -155,7 +157,8 @@ class UserControllerTest extends TestCase
         $body = [
             'userId'    => 'test-ckent',
             'firstname' => 'TEST-CLARK',
-            'lastname'  => 'TEST-KENT'
+            'lastname'  => 'TEST-KENT',
+            'mail'      => 'clark@test.zh'
         ];
         $fullRequest = \httpRequestCustom::addContentInBody($body, $request);
 
@@ -168,7 +171,8 @@ class UserControllerTest extends TestCase
         $body = [
             'userId'    => 'test-ckent',
             'firstname' => 12, // wrong format
-            'lastname'  => 'TEST-KENT'
+            'lastname'  => 'TEST-KENT',
+            'mail'      => 'clark@test.zh'
         ];
         $fullRequest = \httpRequestCustom::addContentInBody($body, $request);
 
@@ -219,7 +223,6 @@ class UserControllerTest extends TestCase
         $responseBody = json_decode((string)$response->getBody(), true);
 
         $this->assertSame('User does not exist', $responseBody['errors']);
-
     }
 
     public function testUpdate()
@@ -1743,7 +1746,6 @@ class UserControllerTest extends TestCase
         $responseBody = json_decode((string)$response->getBody(), true);
         $this->assertIsArray($responseBody['userBaskets']);
         $this->assertEmpty($responseBody['userBaskets']);
-
     }
 
     public function testGetDetailledById()