Fix + test for keys that resolve to directories