Fix C extension segfault.