Add more functionality to the remote attach; fix bug in logging message
where the envelope was not formed correctly.