fixed issue with related tables