Fixed bugs in controllers