diff --git a/functions/methods.js b/functions/methods.js
index 316acec029c64aba01511c810cb8becc79e16042..0037a7e143bab55cee0d9d48b71263818af86b5a 100644
--- a/functions/methods.js
+++ b/functions/methods.js
@@ -68,7 +68,10 @@ var methods = {
     getUserByEmail: async function(email) {
         try {
             let rows = await dbconn.user.promise().query('SELECT id, verificationStatus, salutation, title, firstname, lastname, industry, organisation, speciality, m4lab_idp FROM user WHERE email = "' +email+'"')
-            return rows[0][0]
+            if (rows[0][0]) {
+                return rows[0][0]
+            }
+            else { return null }
         } catch (err) {
             console.error(err)
         }
@@ -77,7 +80,7 @@ var methods = {
     getUserEmailById: async function(userId) {
         try {
             let rows = await dbconn.user.promise().query('SELECT email FROM user WHERE id = ' +userId)
-            if (rows[0]) {
+            if (rows[0][0]) {
                 return rows[0][0].email
             }
             else { return null }
@@ -89,7 +92,7 @@ var methods = {
     checkUserEmail: async function(email) {
         try {
             let rows = await dbconn.user.promise().query('SELECT id, email FROM user WHERE email = "' +email+'"')
-            if (rows[0]) {
+            if (rows[0][0]) {
                 return rows[0][0]
             }
             else { return null }
@@ -102,7 +105,7 @@ var methods = {
         try {
             let rows = await dbconn.user.promise().query('SELECT t1.user_id, t2.email FROM userdb.credential AS t1 INNER JOIN userdb.user AS t2 ON t1.user_id = t2.id AND t1.resetPasswordToken = "'
                 +token+'" and resetPasswordExpires > '+Date.now())
-            if (rows[0]) {
+            if (rows[0][0]) {
                 return rows[0][0]
             }
             else { return null }
@@ -152,7 +155,7 @@ var methods = {
     getVerificationTokenByUserId: async function(userId) {
         try {
             let rows = await dbconn.user.promise().query('SELECT token FROM verification WHERE user_id = "' +userId+'"')
-            if (rows[0]) {
+            if (rows[0][0]) {
                 return rows[0][0].token
             }
             else { return null }
@@ -164,7 +167,7 @@ var methods = {
     getUserIdByVerificationToken: async function(token) {
         try {
             let rows = await dbconn.user.promise().query('SELECT user_id FROM verification WHERE token = "' +token+'"')
-            if (rows[0]) {
+            if (rows[0][0]) {
                 return rows[0][0].user_id
             }
             else {