move all replication to main thread