Fixing crash in controller.py