WIP: fix race and let thread yield