Fix issue when more than one related object defined