Fixed a couple bugs in code I wrote 9 years ago. I should do this more often.

Manton Reece @manton