Fix bug in copy-agent.
More fix on copy-agent.