fix bi-directional replication and add unpublish tasks