thread limit bug fix