GCD of polynomials over $\mathbb{Z}_3$ $f$ and $g$ are polynomials over field $\space \mathbb{Z}_3$. $f=X^4+X^3+X+2, \space g=X^4+2X^3+2X+2$. And I been asked to find the GCD of them.
What I have done is using Euclidean algorithm. After long division I get, 
$$X^4+2X^3+2X+2=(1)(X^4+X^3+X+2)+(X^3+X)$$
So GCD$(f,g)=X^3+X$, however the answer to this is $X^2+1$. I want to know what I did wrong.

This is for the completeness, ever step is done by long division.
$$X^4+2X^3+2X+2=(1)(X^4+X^3+X+2)+(X^3+X) \\ 
X^4+X^3+X+2 = (X+1)(X^3+X)+(X^2+1)(2) \\ 
X^3+X = (2X)(2X^2+2)+0$$
Therefore, the GCD of $f$ ad $g$ is $X^2+1$.
