Fix random segfault