replication.sh working after by_identifer change
improve error checking in replication.sh