Fixed several bugs and typos.

7 files changed