Fix variable shadowing. Due to a bug in GCC's implementation of range-based for
loops, it was making this an error, resulting in buildbot failures.