Fixes issue with for loop not declaring variable.