Fix bug in examples
Changes to pass CRAN check