threads bugfixes