fixed bug calling thread constructor