diff --git a/src/main/lktadm.c b/src/main/lktadm.c
index cb4a68bd24f944484547066f4a6957547ff0f40f..68a26e4290176aed8b43e5109e7917545811f17b 100644
--- a/src/main/lktadm.c
+++ b/src/main/lktadm.c
@@ -131,6 +131,7 @@ init_populate__(struct lkt_cmd_args *args)
 noreturn void
 init_file__(struct lkt_cmd_args *args)
 {
+    open_db();
     int i;
     for (i = 0; i < args->argc; ++i)
         metadata_set_file((char *) args->argv[i], mkvpropedit);
@@ -272,6 +273,7 @@ static struct lkt_cmd_opt options_init[] = {
     { .name = "database",   .call = init_database__ },
     { .name = "populate",   .call = init_populate__ },
     { .name = "metadata",   .call = init_metadata__ },
+    { .name = "file",       .call = init_file__     },
     LKT_OPT_NULL,
 };
 
@@ -293,5 +295,5 @@ static struct lkt_cmd_opt options[] = {
 int
 main(int argc, const char **argv)
 {
-    lkt_cmd_parse(options, argc, argv, help);
+    lkt_cmd_parse(options, argc - 1, argv + 1, help);
 }
diff --git a/src/mkv/write.c b/src/mkv/write.c
index c29dd79ff08ee87b66cad1430dd10b167aaad400..c524b71b73b77f30d69a35b5783b776d4fbb0360 100644
--- a/src/mkv/write.c
+++ b/src/mkv/write.c
@@ -2,7 +2,6 @@
 #define _DEFAULT_SOURCE
 
 #include <lektor/mkv.h>
-#include <pcre.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <unistd.h>
@@ -14,6 +13,10 @@
 #include <fcntl.h>
 #include <sys/stat.h>
 #include <sys/wait.h>
+#include <sys/types.h>
+#include <regex.h>
+
+#include <pcre.h>
 
 static const char *METADATA_TEMPLATE =
     "   <?xml version=\"1.0\" encoding=\"UTF-8\"?>  "