Fix goroutine leak bug