fixed a bug for if condition inside kernels