Fix intermittently broken test