various changes to pass R CMD check