Backport of fix for kernel crash bug