fix r code