Fix another bug in keydir generation