fix goroutine safety issue

Signed-off-by: Joshua Rubin <jrubin@zvelo.com>