Fixed a couple bugs introduced in the refactoring.