fix threads issue