Fix errors in controller.js