Fixes to pass R CMD check --as-cran