various fixes. use threads instead of processes.