Fix bug of gradient from 1 to 2 to 1 case. There is a bug by subtracting y(1), when calculate y(2)