Fixing bug with replica_id