Fix race in test