handle threads safely now