fixed bugs for controller and view