diff --git a/src/lib-sieve/plugins/variables/ext-variables-common.c b/src/lib-sieve/plugins/variables/ext-variables-common.c
index 4014e1d0b49b110f6811b30a17b34ee2ef495f52..c2a7a625ac693415e9dea7c7c931c2de8de2ffaa 100644
--- a/src/lib-sieve/plugins/variables/ext-variables-common.c
+++ b/src/lib-sieve/plugins/variables/ext-variables-common.c
@@ -71,7 +71,7 @@ struct sieve_variable_scope *sieve_variable_scope_create(pool_t pool)
 	scope = p_new(pool, struct sieve_variable_scope, 1);
 	scope->pool = pool;
 	scope->variables = hash_create
-		(pool, pool, 0, str_hash, (hash_cmp_callback_t *)strcmp);
+		(pool, pool, 0, strcase_hash, (hash_cmp_callback_t *)strcasecmp);
 		
 	return scope;
 }
diff --git a/src/lib-sieve/plugins/variables/variables.sieve b/src/lib-sieve/plugins/variables/variables.sieve
index 8e443232a153bce9e2df4a8dffa58be5c708dc17..0355e5452e2177b8ddaebd243f3d0c2a57a48dcc 100644
--- a/src/lib-sieve/plugins/variables/variables.sieve
+++ b/src/lib-sieve/plugins/variables/variables.sieve
@@ -3,9 +3,8 @@ require "fileinto";
 
 set :lower :upperfirst "foo" "FOOSOME";
 set :upperfirst :lower "bar" "BARABLE";
-set :upper :lowerfirst "hutse" "hutsefluts";
-set :lowerfirst :upper "piep" "piepsnot";
-
+set :upper :lowerfirst "HutsE" "hutsefluts";
+set :lowerfirst :upper "pIEp" "piepsnot";
 
 #fileinto "${foo}.${bar}";