some changes to cuda code
fixed merge conflict