using correct varialbles pointing to device memory