Fixes inconsistency in flattenWithPath in favor of elimination of all undefineds.