fixed many R CMD CHECK bugs