Fixing calculation of replication diff