Avoid a deadlock when using replication