corrected formula for kernel