Minor bugfixes

Fixed a few variable names and references.