Fix the memory allocation problem. The problems was in the NumericVector states inside the interface. Make sure all vectors are allocated of the right side. Otherwise, resize or push elements into it.