Fixed bug in controller