Injectivity of a Hom space (This question from the proof of Corollary 10.65 in Rotman's homological algebra.)

Let $R$ and $S$ be rings, let $_S B _R$ be an $(S,R)$-bimodule and let $_S E$ be an injective left $S$-module. If $_S B$ is a projective left $S$-module, then $\text{Hom}_S(B,E)$ is an injective left $R$-module.

I'll assume noetherianity and finite generation throughout to simplify details. I seem to have gotten into a bit of a muddle. Since $_S B$ is projective, there exists $_S B'$ with $B \oplus B' \cong S^n$ for some $n$, as left $S$-modules. Then
$$
\text{Hom}_S(B,E) \oplus \text{Hom}_S(B',E) \cong \text{Hom}_S(S^n,E) \cong{}  _S E^n
$$
 so $\text{Hom}_S(B,E)$ is a direct summand of an injective left $S$-module and so is injective as a left $S$-module.
But a priori $\text{Hom}_S(B,E)$ has no left $S$-module structure, and I haven't got the result I wanted. Where am I going wrong?
 A: I will assume that actually, $B$ is projective as a right $R$-module, not a left $S$-module. I think it's a typo...
Suppose you have an inclusion $i : X \to Y$ of left $R$-modules, and a map of $R$-modules $f : X \to \hom_S(B,E)$. You want to construct a factorization $g : Y \to \hom_S(B,E)$ such that $g \circ i = f$.
The map $f$ is equivalent to a map of $S$-modules $f' : B \otimes_R X \to E$ (given by $f'(b \otimes x) = f(x)(b)$), and the map $i$ induces a map $i' : B \otimes_R X \to B \otimes_R Y$. Since a projective module is flat, $B$ is flat as a right $R$-module, so the map $i'$ is again injective. So since $E$ is injective as a left $S$-module, there is a factorization $g' : B \otimes_R Y \to E$, which induces the factorization $g : \hom_S(B,E) \to Y$ you wanted.

For completeness, things don't necessarily work if $B$ is not flat as an $R$-module. Let $B$ be the $\newcommand{\Z}{\mathbb{Z}}(\Z/2Z, \Z) = (S,R)$-bimodule $\Z/2\Z$. It is projective as a left $S$-module (but not even flat as a left $R$-module). Let also $E = \Z/2\Z$: it's an injective left $S$-module ($\Z/n\Z$ is injective over itself).
$$\hom_S(B,E) = \hom_{\Z/2\Z}(\Z/2\Z, \Z/2\Z) \cong \Z/2\Z$$
as a left $R$-module.
Let $X = Y = \Z$ be seen as left $R$-modules. Let $i : X \to Y$ be multiplication by $2$ (it's injective) and let $f : X \to \hom_S(B,E) = \Z/2\Z$ be the quotient map. Then there is no way to factor $f$ through $i$ (check it), so $\hom_S(B,E)$ is not injective as a left $R$-module.
