fix "race conditions" on to