Fix bugs in controllers