diff --git a/src/lib-sieve/sieve-script.c b/src/lib-sieve/sieve-script.c
index 141f63aa8532b448b085234ba74f4b10354ffa4e..05d175320978decc063c9d4dcd320cf44ee6717b 100644
--- a/src/lib-sieve/sieve-script.c
+++ b/src/lib-sieve/sieve-script.c
@@ -89,7 +89,11 @@ struct sieve_script *sieve_script_init
 		}
 
 		basename = _sieve_scriptfile_get_basename(filename);
-		binpath = t_strconcat(dirpath, "/", basename, ".svbin", NULL);
+
+		if ( *dirpath == '\0' )
+			binpath = t_strconcat(basename, ".svbin", NULL);
+		else
+			binpath = t_strconcat(dirpath, "/", basename, ".svbin", NULL);
 				
 		if ( name == NULL ) {
 			name = basename;