Various bugfixes

Fixed a variety of bugs, primarily typos.