Fixed test to be more reliable.