Fix thread system error after memory garbage collected.