Preserve reference in for loop