fixed R1 and R2 bug