cleanup before replication