fixed code defect in controller