Fix a minor race condition