Fixed a bug or two that were introduced during refactor.