bugfixes in prep for CRAN