Cleanup for kernel