fixed a bug in controller.js