Fix bug which led to intermittent test failure.