Fixed a bug in controller