Fixes for tests and R CMD CHECK.