Add very basic unit testing of controller.py.
A bugfix in controller.py found during testing.