Hi, I'm very new here and unfamiliar with R. However, I feel like I can still provide some input. This is a bug, it must not use DATAPTR. Perhaps this is a suitable replacement for these instances: xd = x[1]; A safer temporary option is to drop this flag. I am unsure whether that is acceptable though.