Fix ancestor check method when ancestorFolderId==0 (root folder)