Fixed bugs in kernel.cu