Fix randomly test segfaults.