Fixes to pass R CMD CHECK