Made some changes to make it run with CUDA 4.2