Fix instability in tests