correct kernel for even and odd dimensions