Fix for various threading crashes during stress test