fix bug with goroutine