Fixing flaky tests.

Fixing flaky test introduced #499 in and affecting #510 build.