Make some time-fragile tests more robust