Fix bugs in router and base controller, all specs pass