Fixed a whole bunch of bugs in controller node