various fixes, mostly threading and exceptions related