Multithread enviroment fixes and features