Morphism of vector bundles in the smooth setting It is a standard fact that if one wants good categorical properties from a map of vector bundles in the smooth category, say that kernel and cokernel sheaves are themselves vector bundles, one needs to work with maps having constant rank at each fiber. Then there exist trivializations in which the map has this simple form $$(x; v_1,...,v_r,...,v_n) \mapsto (x; v_1, ...,v_r, 0,...,0)$$ and it follows that kernel and cokernel are locally trivial.
These notes take a different approach, namely (definition 8.8):
A morphism between locally free sheaves $\phi: \mathcal{B} \to \mathcal{B'}$ is a morphism between vector bundles if the map on stalks has free kernel and free cokernel at each point.
Then problem 8.28 of the same notes basically asks to prove that for such $\phi$, kernel, image and cokernel sheaves are locally free, i.e. vector bundles.
This is exactly where I got stuck: it seems that the condition of being constant rank at fibers is stronger than having free kernel and cokernel at the stalk level.
How does one ensure that the rank of those free kernel and cokernel $(C^{\infty}M)_x$-modules doesn't vary from point to point? [I believe that if one can show that this rank is locally constant, then we are done - passing to fibers we will have constant rank on fibers, as before.]
In algebraic geometry it is a consequence of Nakayama-like statement that freeness of the stalk at a point implies freeness of the sheaf in a neighborhood, but I beleive it is not true for a smooth manifold; or is it?
 A: We may as well work locally on $M$ and so assume our vector bundles are trivial.  So let us say we have a map of sheaves $\phi:F\to G$ where $F=(C^\infty M)^m$ and $G=(C^\infty M)^n$, which we can represent as multiplication by an $n\times m$ matrix $(\phi_{ij})$ of smooth functions on $M$.  Let $K$ be the cokernel sheaf of $\phi$.  I first claim that the dimension of the fiber of $K$ at a point $x$ is $n$ minus the rank of the matrix $(\phi_{ij}(x))$.
Indeed, the exact sequence of sheaves $F\to G\to K \to 0$ gives an exact sequence of fibers $F|_x\to G|_x\to K|_x\to 0$ (taking fibers is right exact).  We can identify $F|_x$ and $G|_x$ with $\mathbb{R}^m$ and $\mathbb{R}^n$ and then the map between them is just given by the matrix $(\phi_{ij}(x))$.  So, the dimension of $K|_x$ is just the dimension $n$ of $G|_x$ minus the rank of this matrix.
It follows that the dimension of $K|_x$ is upper semicontinuous: for each $r$, the set of $x\in M$ such that $K|_x$ has dimension at most $r$ is open.  Now I claim that if the stalk $K_x$ is free, then the dimension of the fiber is actually also lower semicontinuous at $x$.  That is, letting $r$ be the dimension of $K|_x$, I claim there is a neighborhood $U$ of $x$ such that $K|_y$ has dimension at least $r$ for all $y\in U$.
To prove this, suppose it is not true, so we have a sequence of points $y_k$ approaching $x$ such that $K|_{y_k}$ has dimension at most $r-1$ for each $k$.  That means the matrix $(\phi_{ij}(y_k))$ has rank at least $n-r+1$ for each $k$.  For each $k$, choose sections $f_{0k},f_{1k},\dots,f_{(n-r)k}$ of $F$ in a neighborhood of $y_k$ such that the vectors $\phi(f_{ik})(y_k)$ are linearly independent. 
Now we are assuming $K_x$ is free and $K|_x$ is $r$-dimensional, so $K_x$ has rank $r$.  In particular, we can find sections $g_1,\dots,g_r$ of $G$ in some neighborhood $U$ of $x$ whose images in $K_x$ are linearly independent.  We assume for convenience that $y_k\in U$ for all $k$.
Now note that since the $\phi(f_{ik})$ are linearly independent at $y_k$, they are also linearly independent in a neighborhood of $y_k$.  So, looking in a small neighborhood of $y_k$, we have $n+1$ sections $\phi(f_{0k}),\dots,\phi(f_{(n-r)k}),g_1,\dots,g_r$ of $G=(C^\infty M)^n$, so they must be linearly dependent.  Since the $\phi(f_{ik})$ are linearly independent, a nontrivial linear relation must involve the $g_i$.  That is, there is some nontrivial linear combination of the $g_i$ which is equal to a linear combination of the $\phi(f_{ik})$ (in some neighborhood of $y_k$); say $\sum a_{ik}g_i=\sum b_{ik}\phi(f_{ik})$ where some $a_{ik}$ is nonzero at $y_k$.
Now we just glue all these relations together using bump functions.  Choose bump functions $\psi_k$ supported in small disjoint neighborhoods of $y_k$ and nonzero scalars $c_k$ which go to $0$ fast enough so that the sums $a_i=\sum c_k^2\psi_k^2a_{ik}$, $b_i=\sum c_k\psi_k b_{ik}$, and $f_i=\sum c_k\psi_k f_{ik}$ are all smooth.  We then have the relation $$\sum a_ig_i=\sum b_i\phi(f_{i})$$ on an entire neigbhborhood of $x$, where the $a_i$ are not all $0$ in any neighborhood of $x$.  This means that the $g_i$ are not actually linearly independent in $K_x$ (since there is a linear combination of them which has nontrivial coefficients in any neighborhood of $x$ and is equal to something in the image of $\phi$).  This is a contradiction.
Thus, assuming $K_x$ is free for all $x$, the rank of the fibers of $K$ is not just upper semicontinuous but continuous (i.e., locally constant).  In other words, the matrix $(\phi_{ij})$ has locally constant rank, which means as usual that the kernel and cokernel sheaves are locally free (on open sets, not just on stalks).
