fix a lot of warnings and notes produced by R CMD check