fix race condition by creating local req/err variables inside the goroutine