From: Rabbi Moshe Sofer
To: Rabbi Sinai
The Chasam Sofer rules that non-standard Hei forms in Divine Names do not invalidate the letters, since a child would still recognize them as Hei, but they must be corrected by filling in the air space with ink applied with sacred intent rather than by erasure. On the mamzer question, he rejects the Shach's reasoning and upholds the Mordechai's position, arguing that since a Sefer Torah missing even one letter is invalid and a mamzer cannot personally fulfill the mitzvah of writing a Torah, he cannot serve as an agent for others, rendering the entire Sefer Torah he writes invalid.
Source: Shu"t Chasam Sofer YD §271