diff --git a/libc3/env.c b/libc3/env.c
index 258a84d..451736f 100644
--- a/libc3/env.c
+++ b/libc3/env.c
@@ -782,13 +782,12 @@ s_env * env_init_args (s_env *env, sw argc, s8 **argv)
if (argv) {
env->argc = argc;
env->argv = argv;
- dir = malloc(strlen(argv[0]) + 1);
- dirname_r(argv[0], dir);
+ dir = dirname(argv[0]);
len = strlen(dir);
assert(len);
dir[len + 1] = '\0';
dir[len] = '/';
- str_init_1(&env->argv0_dir, dir, dir);
+ str_init_copy_1(&env->argv0_dir, dir);
}
else {
env->argc = 0;
diff --git a/libc3/facts.c b/libc3/facts.c
index d23d3d3..ba0c1cd 100644
--- a/libc3/facts.c
+++ b/libc3/facts.c
@@ -44,6 +44,7 @@ s_fact * facts_add_fact (s_facts *facts, const s_fact *fact)
tmp.subject = facts_ref_tag(facts, fact->subject);
tmp.predicate = facts_ref_tag(facts, fact->predicate);
tmp.object = facts_ref_tag(facts, fact->object);
+ tmp.id = 0;
if ((item = set_get__fact(&facts->facts, &tmp))) {
facts_lock_unlock_w(facts);
return &item->data;