Fixed issue in getDirectAncestor() function for the case where it returns a FileNotFound error.