R: bug fixed