Fix random segfaults.