Fix race condition spotted by mcphail. Now we will get correct worker ids.