Fix broken threads structure (#1489845)
Small code improvements