Fixed errors compiling kernels in double precision mode
Made test cases more robust