Rcpp import changes and misc fixes and tests