Protoproxy template variable scope fixups

When this file was being cleaned up for variable
qualification, local each-loop variables were mis-qualified
as global, and one actual global reference was missed.

Change-Id: I26f5e171c77959dd7cc8086eeab4c53bf4d747e7