fixed handling of the cyclic relations in entities