undef USE_RINTERNALS at end of c source; some minor changes