Kernel: various improvements