moved substitutions to postPatch phase and commented on workaround sed line, as requested in the code reviews