This may cause a potential bug; it is allowed to have multiple directory element, in which case the key becomes an array. I think it is good enough to assume that in this case the first element needs to be used