fixed ambiguous Rcpp code