Bug fix in controller