attempt to fix a bug in extension module when running it on GPUs.