Fixed #379 and some typos.
Merge pull request #382 from marcj/port-561

Fixed #379 and some typos.