Bugfix: pid for parent was incorrectly determined when child tables and variants are used.