Fix a stats update race condition.