Fix relations retrieval for different entities bug