Fix test crashes visible in CI environment.