Fix some regression/port bugs and bugs in the json-rpc module.