Added tests for the base controller.

And fixed a couple minor issues the tests exposed.