Fix archive redirection.
Some simplifications.
g.THREAD -> g.THREADID