Updated some typos

Fixed some incorrect variable references.
Merge pull request #886 from talam/patch-1

Updated some typos