More race condition fixes.