Why such a morphism of covering spaces is a covering transformation? I am having a hard time with the following problem:

Let $q\colon Y\to X$ be a covering map of finite degree where $X$ and $Y$ are connected topological spaces. Suppose that $f\colon Y\to Y$ is a morphism of covering spaces, i.e., a continuous map such that $q\circ f=q$. Then $f$ is homeomorphic and thus is a covering transformation.

Where I am stuck is the verification of injectiveness of $f$ (if it is verified, the surjectiveness and bicontinuity will follow rather straightforward), and I have completely no idea how the fact that $q$ has finite degree is applied to prove the injectiveness of $f$. Any help is appreciated...
 A: You also have the connected hypothesis, which is crucial here. In fact it's easier to show that $f$ is surjective first. Injectivity then follows from the fact that $Y$ is of finite degree, and the fact that $f$ is an open map then follows from the fact that it's a morphism of covering spaces.
So let's show that $f$ is surjective. Let $Z \subset Y$ be the image of $f$. It's obviously nonempty. Let's show that it's open and closed. As $Y$ is path-connected, it's also connected, hence $Z$ will necessarily be the whole space. Let $d$ be the degree of $Y \to X$.


*

*$Z$ is open: Let $z \in Z$ and let us look for a neighborhood of $z$ entirely contained in $Z$.
By definition $z = f(y)$ for some $y \in Y$. Let $x = q(z) = q(y)$. There exists an open neighborhood $U \subset X$ of $x$ over which $q$ is trivial, i.e. $q^{-1}(U) \cong U \times \{1, \dots, d\}$ and $q$ is the projection. There exist $i, j \in \{1,\dots,n\}$ such that $y = (x,i)$ and $z = (x,j)$ under the homeomorphism $q^{-1}(U) = U \times \{1,\dots,d\}$. As $f$ is a morphism of covering spaces, it follows that $f(U \times \{i\}) = U \times \{j\}$, hence $U \times \{j\}$ is a neighborhood of $z$ which is contained in $Z = \operatorname{im} f$.

*$Z$ is closed: Similarly, suppose that $z \in Y$ does not belong to $Z$. Let's look for a neighborhood of $z$ which does not intersect $Z$.
Let $x = q(z)$ and take a neighborhood $x \in U \subset X$ over which $q$ is trivial, i.e. $q^{-1}(U) \cong U \times \{1,\dots,d\}$. We have $z = (x,j)$ for some $1 \leq j \leq d$. Now I claim of $U \times \{j\}$ is entirely contained in $Y \setminus Z$, i.e. it does not intersect $Z$. To the contrary, suppose that $U \times \{j\} \cap Z$ is nonempty, and let $z' = f(y')$ be an element and let $q(z') = q(y') = x'$. Then $y' = (x',i)$ for some $1 \le i \le d$, and then since $f$ is a morphism of covering spaces, it follows that $f(x,i) = (x,j) = z$. This is a contradiction.

If you want a counterexample with $Y$ not connected, consider $Y = X \times \{0,1\}$ a disjoint union of two copies of $X$, and consider the map $f : Y \to Y$ given by $f(x,i) = (x,0)$.
