Fixed bug introduced in commit c9402d9ecc1d063a96e583d82a07028aeadc49eb ...

...for local threads

(cherry picked from commit 9ca6898446017a989ca8bd026638a62a36b5c6a3)