fix bug in controller