Fix cuda 2

Modified version of https://github.com/numba/numba/pull/848