Fixed foreach() reference variables to not throw unused variable errors.