More fixes to kernel calculation.