plugin: copy variables to the plugin.

closes #904.