set primary address of address entity based on relation; test fixes