[fix] Fix nasty race condition.