bug fix and update for R 3.0.0