Fix rare test failure with timing problems