fix R generation error