typos

Just fixing some typos. Note there are some fixes in code that should be reviewed carefully.