Fix error in controller code, output json