gold plugin: move target initialization to the top of the onload function.