fixed replication bug