multithreading waiting fixes