Let $R$ be commutative ring with 1. Suppose we have the following exact sequences of $R$-modules.
\begin{array}{ccccccccc} 0 & \rightarrow & M'& \xrightarrow{f} & M& \xrightarrow{q} & M''& \rightarrow& 0\\ & & & & \downarrow{b}& & \downarrow{c}& & \\ 0 & \rightarrow & N'& \xrightarrow{f'} & N& \xrightarrow{q'} & N''& \rightarrow& 0\\ \end{array} Suppose the diagram above commutes. Then we get a morphism $a:M'\rightarrow N'$ such that we get the following commutative diagram.
\begin{array}{ccccccccc} 0 & \rightarrow & M'& \xrightarrow{f} & M& \xrightarrow{q} & M''& \rightarrow& 0\\ & & \downarrow{a} & & \downarrow{b}& & \downarrow{c}& & \\ 0 & \rightarrow & N'& \xrightarrow{f'} & N& \xrightarrow{q'} & N''& \rightarrow& 0\\ \end{array} Then by snake lemma we get an exact sequence $$0\rightarrow Ker\,a\rightarrow Ker\,b\rightarrow Ker\,c\xrightarrow{\phi} Coker\,a\rightarrow Coker\,b\rightarrow Coker\,c\rightarrow 0.$$
However, I have a naive doubt. We can replace the second exact sequence by the images of the corresponding maps.
\begin{array}{ccccccccc} 0 & \rightarrow & M'& \xrightarrow{f} & M& \xrightarrow{q} & M''& \rightarrow& 0\\ & & \downarrow{a} & & \downarrow{b}& & \downarrow{c}& & \\ 0 & \rightarrow & im\,a & \xrightarrow{f'} & im\,b &\xrightarrow{q'} & im\,c& \rightarrow& 0\\ \end{array}
Applying snake lemma to above diagram, we get $$0\rightarrow Ker\,a\rightarrow Ker\,b\rightarrow Ker\,c\rightarrow 0$$.
This seems to mean that $\phi$ is the zero map. Am I making a mistake somewhere?