fix typo and coding style in #638

In #638 as pointed out by Reynold, there are some typo and coding style issues. Fix it here.