A bunch of minor fixes and typos

Oh, yeah, thanks!
BTW, it's naming problem. In method right before this one argument is named `val`, kind of inconsistent...