fix bug with in the github example
add testthat for tests
* add a test to fix bug