fix a goroutine leak issue