Fixed bugs in Controller class