Mostly fixed multithreading under Linux; 1 random deadlock left