Bugfixes

I pulled this down to follow along with the tutorial and noticed a couple of bugs that were preventing it from working as intended.