diff --git a/src/lib-sieve/cmd-redirect.c b/src/lib-sieve/cmd-redirect.c
index 6fe209c82f07c0ad0bef642a34efddeb76417307..996b904593688528dbe18ec5bfe2ec380f2dd4e4 100644
--- a/src/lib-sieve/cmd-redirect.c
+++ b/src/lib-sieve/cmd-redirect.c
@@ -22,6 +22,7 @@
 #include "sieve-code-dumper.h"
 #include "sieve-result.h"
 #include "sieve-smtp.h"
+#include "sieve-message.h"
 
 #include <stdio.h>
 
diff --git a/src/lib-sieve/plugins/mailbox/tag-mailbox-create.c b/src/lib-sieve/plugins/mailbox/tag-mailbox-create.c
index 228c0044c3620f9578f641e25eb0b6a31e457405..f2bb4622b1ea93b900cab6f8c9f5e05d1ebd03d5 100644
--- a/src/lib-sieve/plugins/mailbox/tag-mailbox-create.c
+++ b/src/lib-sieve/plugins/mailbox/tag-mailbox-create.c
@@ -7,6 +7,7 @@
 
 #include "sieve-common.h"
 #include "sieve-commands.h"
+#include "sieve-actions.h"
 #include "sieve-code.h"
 #include "sieve-actions.h"
 #include "sieve-result.h"
@@ -115,7 +116,7 @@ static void seff_mailbox_create_print
 
 static bool seff_mailbox_create_pre_execute
 (const struct sieve_side_effect *seffect ATTR_UNUSED, 
-	const struct sieve_action *action, 
+	const struct sieve_action *action ATTR_UNUSED, 
 	const struct sieve_action_exec_env *aenv ATTR_UNUSED,
 	void **se_context ATTR_UNUSED, void *tr_context ATTR_UNUSED)
 {	
diff --git a/src/lib-sieve/plugins/notify/cmd-notify.c b/src/lib-sieve/plugins/notify/cmd-notify.c
index 39b7afa5fd6de23c032b5d9fc47b4252752d234f..90a84d5834734e9cd59c4e06f980d5de0f5f4f6b 100644
--- a/src/lib-sieve/plugins/notify/cmd-notify.c
+++ b/src/lib-sieve/plugins/notify/cmd-notify.c
@@ -787,7 +787,6 @@ static bool act_notify_send
 (const struct sieve_action_exec_env *aenv, 
 	const struct ext_notify_action *act)
 { 
-	const struct sieve_message_data *msgdata = aenv->msgdata;
 	const struct sieve_script_env *senv = aenv->scriptenv;
 	const struct ext_notify_recipient *recipients;
 	void *smtp_handle;
diff --git a/src/lib-sieve/sieve-actions.c b/src/lib-sieve/sieve-actions.c
index cee98d669a752086fd1571881b8d273d53230dfe..7150366e1c5417e2121717926805f01782f6b77b 100644
--- a/src/lib-sieve/sieve-actions.c
+++ b/src/lib-sieve/sieve-actions.c
@@ -236,16 +236,6 @@ static void act_store_print
 
 /* Action implementation */
 
-static void act_store_get_storage_error
-(const struct sieve_action_exec_env *aenv, struct act_store_transaction *trans)
-{
-	enum mail_error error;
-	pool_t pool = sieve_result_pool(aenv->result);
-	
-	trans->error = p_strdup(pool, 
-		mail_storage_get_last_error(trans->namespace->storage, &error));
-}
-
 static struct mailbox *act_store_mailbox_open
 (const struct sieve_action_exec_env *aenv, const char **mailbox,
 	struct mail_namespace **ns_r, const char **folder_r)
diff --git a/src/lib-sieve/sieve-actions.h b/src/lib-sieve/sieve-actions.h
index e14a8a61582236a5d40cf6be708967757b74f28f..901e5050ff838643c8a041509297fcabba3093a4 100644
--- a/src/lib-sieve/sieve-actions.h
+++ b/src/lib-sieve/sieve-actions.h
@@ -219,6 +219,9 @@ void sieve_act_store_add_flags
 	(const struct sieve_action_exec_env *aenv, void *tr_context,
 		const char *const *keywords, enum mail_flags flags);
 
+void sieve_act_store_get_storage_error
+	(const struct sieve_action_exec_env *aenv, struct act_store_transaction *trans);
+
 /*		
  * Action utility functions
  */