fixed bug for deleted records in relating sets