Update controller.py

Update in attempt to improve error catching