diff --git a/src/lib-sieve/plugins/regex/mcht-regex.c b/src/lib-sieve/plugins/regex/mcht-regex.c
index cc8c37acb3e7b0bd759f5c2994108b64fc1b734c..c14f293480e040d89cc1a0db14aef85d75449d9e 100644
--- a/src/lib-sieve/plugins/regex/mcht-regex.c
+++ b/src/lib-sieve/plugins/regex/mcht-regex.c
@@ -100,11 +100,11 @@ static int mcht_regex_validate_regexp
 			str_sanitize(regex_str, 128), _regexp_error(&regexp, ret));
 
 		regfree(&regexp);
-		return FALSE;
+		return -1;
 	}
 
 	regfree(&regexp);
-	return TRUE;
+	return 1;
 }
 
 struct _regex_key_context {
@@ -126,7 +126,7 @@ static int mcht_regex_validate_key_argument
 			(keyctx->valdtr, keyctx->mtctx, key, keyctx->cflags);
 	}
 
-	return TRUE;
+	return 1;
 }
 
 static bool mcht_regex_validate_context
@@ -158,8 +158,8 @@ static bool mcht_regex_validate_context
 	keyctx.cflags = cflags;
 
 	kitem = key_arg;
-	if ( !sieve_ast_stringlist_map(&kitem, (void *) &keyctx,
-		mcht_regex_validate_key_argument) )
+	if ( sieve_ast_stringlist_map(&kitem, (void *) &keyctx,
+		mcht_regex_validate_key_argument) <= 0 )
 		return FALSE;
 
 	return TRUE;