Fixed a few small typos

Just a few typos I discovered while reading the code (and a few corrected using aspell, too).

The overall code looks good to me and it seems to work as expected.