Fix bug in CUDA kernel function which calculates track distance