Added error checking for kernel launches.