Bug fixes from R CMD check