Incomming fixes from Charles on the replication branch.