How does this reduction to prove undecidability account for epsilon? I have the following proof that the Empty String problem:
   ES = {M | M accepts $\epsilon$}
 is undecidable:

$f&lt;M,w&gt;$ = Construct a new machine $M_2$ such that:
$M_2$ = given input x erase x from the tape and run M on w:
if M accepts w $\longrightarrow$ accept
if M rejects w $\longrightarrow$ accept
if M loops on w $\longrightarrow$ loop  

I see how the function only accepts when the halting problem accepts since it only accepts when M accepts/rejects (halts).  However I don't see how it only accepts when M accepts $\epsilon$ too.  If for example M rejects $\epsilon$ then $M_2$ would accept since M halted on w. Wouldn't this be a flaw in the reduction?  How does this reduction account for $\epsilon$?
Let $x = \langle M, w \rangle \in H$, where $H$ is the usual haltingproblem. Then $\langle M_2 \rangle$ halts on every input, especially on $\varepsilon$ and by construction accepts every input, especially $\varepsilon$. Hence, $f(x) = \langle M_2 \rangle \in ES$.

Now assume $x = \langle M, w \rangle \notin H$, i.e. $M$ loops on $w$. Then $M_2$ loops on every input, especially $\varepsilon$ and thus, never accepts it. $\langle M_2 \rangle \notin ES$.