Fix for a race condition