Fixes #227 by properly scoping the variables within the go routine.