Fix closing table tag and TableQuery type in controller.