threading bug fix
Split complete - needs to be tested
small bugfixes