recopiled for R version 3.0