improve for R 3.0