fixed racing condition in tests