Fix a data race condition