adaption for variable substitution for MS>6.4

and some typo corrections