fixed some errors, merging to release branch to push to CRAN