fixed null ref issue with relationship adding