fixed R bug