Fix bug in controller