Fixing a race condition on whitelisting