Fixed a bug in the controller