Fix a subtle bug: don't use loop variable in goroutine