fixed issues for R 3.x