Fixed segfault in kernel patch