[BenweiZhu] refactor piParents condition