Enhance safe multithreading