Found the offset and cuda memory allocation bug. Now it works!!