web: Fix race condition