Improved threading robustness