fix(upgrades): Make sure local variable doesn't leak into global scope

Major issue flagged by our friends over at Scrutinizr