fixing replication bugs