draft version for log replication; need more test / debug