Fix a couple of small errors

Fixes a couple of small exceptions that were happening in the code.