Fix bugs in controller tests