factors out getLastChild from DirectoryDescriptor, because it was too stupid for words