implement support for loops in the replication topology