Removal of global assignment to pass CRAN check